From 81483e0f27c1d791f9a429e0e8e5506f0eb43b4a Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Thu, 25 Nov 2004 12:59:26 +0000 Subject: [PATCH] - added tools/imager to the distribution. This is still very experimental and untested. Patches welcome, if you write tests to go with them. --- Changes | 4 ++++ MANIFEST | 1 + tools/imager | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 9e2059d3..a8096e37 100644 --- a/Changes +++ b/Changes @@ -877,6 +877,7 @@ Revision history for Perl extension Imager. resolve https://rt.cpan.org/Ticket/Display.html?id=7948 - i_writegif_low() wasn't setting the returned global palette, which meant a rubbish palette was returned to the user (detected with valgrind) +- built 0.43_02 for testing 0.43_03 @@ -904,6 +905,9 @@ Revision history for Perl extension Imager. but one step at a time) - added bmp_compression_name, bmp_used_colors, bmp_filesize, bmp_bit_count tags on reading a BMP file +- added tools/imager to the distribution. This is still very + experimental and untested. Patches welcome, if you write tests to go + with them. ================================================================= diff --git a/MANIFEST b/MANIFEST index 43653ca7..e1a0d04c 100644 --- a/MANIFEST +++ b/MANIFEST @@ -205,6 +205,7 @@ testimg/trimgdesc.gif testimg/trmiddesc.gif tga.c Reading and writing Targa files tiff.c +tools/imager Command-line tool for imager (experimental) trans2.c transform.perl Shell interface to Imager::Transform typemap diff --git a/tools/imager b/tools/imager index 064010ea..a2bd9fb6 100755 --- a/tools/imager +++ b/tools/imager @@ -12,8 +12,10 @@ my $help; my $verbose; my $backup; # backup extension name my $directory; # output directory +my $output; my $type; my %write_opts; # options supplied to write() +my $understand; my @collection; # actions/options in order to allow us to set values as needed @@ -67,15 +69,30 @@ GetOptions('help' => sub { $help_func->("synopsis") }, 'type|t=s' => \$type, # output file type 'write-option|wo=s' => \%write_opts, 'output|o=s' => \$output, + 'understand' => \$understand, @getoptions, 'help-color-spec' => sub { $help_func->("color specifications") }, + 'help-actions' => sub { $help_func->("actions") }, + 'help-options' => sub { $help_func->("processing options") }, + 'help-general' => sub { $help_func->("general options") }, ) or usage(); $did_help and exit; +unless ($understand) { + print STDERR <errstr,"\n"; + } } sub _replace_codes { @@ -188,6 +208,19 @@ sub req_info_format { $im; } +sub req_tags { + my ($im, $ignored, $state) = @_; + + print $state->{filename},"\n"; + my @tags = $im->tags; + for my $tag (sort { $a->[0] cmp $b->[0] } @tags) { + my $name = shift @$tag; + print " $name: @$tag\n"; + } + + return; +} + sub val_scale { my ($option, $value) = @_; @@ -312,6 +345,7 @@ sub im_functions { return ( info => [ \&req_info ], + tags => [ \&req_tags ], scale => [ \&req_scale, \&val_scale ], rotate => [ \&req_rotate, \&val_rotate ], caption => [ \&req_caption ], @@ -411,9 +445,12 @@ imager - Imager command-line image manipulation tool imager [--font-size ] [--fs ] [--background ] [--bg ] [--foreground ] [--fg ] [--rotate ] [--scale ] - [--caption ] [--info] [--font fontfile] files ... + [--caption ] [--info] [--tags] [--font fontfile] files ... imager --help-I