Image/Convert.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 12 / 12 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Identify/Ssh.pm ↑ Summary Image/Exif.pm »
1 #
2 # $Id$
3 #
4 # image::convert Brik
5 #
6 package Metabrik::Image::Convert;
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use base qw(Metabrik::Shell::Command Metabrik::System::Package);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub brik_properties {
13 return {
14 revision => '$Revision$',
15 tags => [ qw(unstable) ],
16 author => 'GomoR <GomoR[at]metabrik.org>',
17 license => 'http://opensource.org/licenses/BSD-3-Clause',
18 attributes => {
19 output => [ qw(file) ],
20 delay => [ qw(microseconds) ],
21 },
22 attributes_default => {
23 delay => 50,
24 },
25 commands => {
26 install => [ ], # Inherited
27 to_animated_gif => [ qw($files output|OPTIONAL delay|OPTIONAL) ],
28 },
29 require_binaries => {
30 'convert' => [ ],
31 },
32 need_packages => {
33 ubuntu => [ qw(imagemagick) ],
34 debian => [ qw(imagemagick) ],
35 kali => [ qw(imagemagick) ],
36 },
37 };
38 }
39  
40 sub to_animated_gif {
41 my $self = shift;
42 my ($files, $output, $delay) = @_;
43  
44 $output ||= $self->output;
45 $delay ||= $self->delay;
46 $self->brik_help_run_undef_arg('to_animated_gif', $files) or return;
47 $self->brik_help_run_invalid_arg('to_animated_gif', $files, 'ARRAY') or return;
48 $self->brik_help_run_empty_array_arg('to_animated_gif', $files) or return;
49  
50 my $file_list = join(' ', @$files);
51 $self->execute("convert -delay $delay -loop 0 $file_list $output") or return;
52  
53 return $output;
54 }
55  
56 1;
57  
58 __END__
« Identify/Ssh.pm ↑ Summary Image/Exif.pm »