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
'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 <<EOS;
+This tool is under-tested and will probably destroy your data.
+
+If you understand and agree with this use the --understand option.
+
+In fact, only the --info and --tags actions have been used at all.
+EOS
+ die;
+}
+
exists $write_opts{file}
and die "Illegal write option 'file'\n";
exists $write_opts{type}
}
}
}
+ else {
+ print STDERR "Failed reading $name: ",$im->errstr,"\n";
+ }
}
sub _replace_codes {
$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 req_palette {
+ my ($im, $ignored, $state) = @_;
+
+ print $state->{filename},"\n";
+ if ($im->type eq 'direct') {
+ print " No palette - this is a direct color image\n";
+ }
+ else {
+ my @colors = $im->getcolors;
+ for my $index (0..$#colors) {
+ printf "%3d: (%3d, %3d, %3d)\n", $index, ($colors[$index]->rgba)[0..2];
+ }
+ }
+
+ return;
+}
+
sub val_scale {
my ($option, $value) = @_;
return
(
info => [ \&req_info ],
+ tags => [ \&req_tags ],
+ palette => [ \&req_palette ],
scale => [ \&req_scale, \&val_scale ],
rotate => [ \&req_rotate, \&val_rotate ],
- caption => [ \&req_caption ],
+ # caption => [ \&req_caption ], # not done yet
);
}
imager [--font-size <size>] [--fs <size>] [--background <color>]
[--bg <color>] [--foreground <color>] [--fg <color]
[--info-format <format>] [--rotate <angle>] [--scale <scale-spec>]
- [--caption <text>] [--info] [--font fontfile] files ...
+ [--caption <text>] [--info] [--tags] [--font fontfile] files ...
imager --help-I<option>
- imager --help-I<operation>
+ imager --help-I<operation>
+ imager --help-options
+ imager --help-actions
+ imager --help-general
=head1 DESCRIPTION
No output image file is produced.
+=item --tags
+
+Displays all the tags the Imager reader for that format sets for each
+file.
+
+See L<Imager::Files> for file format specific tags and
+L<Imager::ImageTypes> for common tags.
+
+=item --palette
+
+Dumps the palette of the given file, if it is an indexed image.
+
=item --scale <scalefactor>
=item --scale <width>x<height>
=item --caption text
+Not implemented yet.
+
Expands the image to create a caption area and draws the given text in the
current font.