i_haar
i_count_colors
-
i_gaussian
i_conv
defaults => { },
callsub => sub { my %hsh = @_; i_gaussian($hsh{image}, $hsh{stddev}); },
};
+ $filters{mosaic} =
+ {
+ callseq => [ qw(image size) ],
+ defaults => { size => 20 },
+ callsub => sub { my %hsh = @_; i_mosaic($hsh{image}, $hsh{size}) },
+ };
+ $filters{bumpmap} =
+ {
+ callseq => [ qw(image bump elevation lightx lighty st) ],
+ defaults => { elevation=>0, st=> 2 },
+ callsub => sub {
+ my %hsh = @_;
+ i_bumpmap($hsh{image}, $hsh{bump}{IMG}, $hsh{elevation},
+ $hsh{lightx}, $hsh{lighty}, $hsh{st});
+ },
+ };
+ $filters{postlevels} =
+ {
+ callseq => [ qw(image levels) ],
+ defaults => { levels => 10 },
+ callsub => sub { my %hsh = @_; i_postlevels($hsh{image}, $hsh{levels}); },
+ };
+ $filters{watermark} =
+ {
+ callseq => [ qw(image wmark tx ty pixdiff) ],
+ defaults => { pixdiff=>10, tx=>0, ty=>0 },
+ callsub =>
+ sub {
+ my %hsh = @_;
+ i_watermark($hsh{image}, $hsh{wmark}{IMG}, $hsh{tx}, $hsh{ty},
+ $hsh{pixdiff});
+ },
+ };
$FORMATGUESS=\&def_guess_type;
}
return $self;
}
-
# Copy an entire image with no changes
# - if an image has magic the copy of it will not be magical
# yes the code isn't here yet - next week maybe?
# Next week? Are you high or something? That comment
# has been there for half a year dude.
-
+ # Look, i just work here, ok?
if (!$input{type} and $input{file}) {
$input{type}=$FORMATGUESS->($input{file});
$self->{ERRSTR}='format not supported'; return undef;
}
- my %iolready=(jpeg=>1, png=>1, tiff=>1, pnm=>1, raw=>1);
+ my %iolready=(jpeg=>1, png=>1, tiff=>1, pnm=>1, raw=>1, bmp=>1);
if ($iolready{$input{type}}) {
# Setup data source
$self->{DEBUG} && print "loading a png file\n";
}
+ if ( $input{type} eq 'bmp' ) {
+ $self->{IMG}=i_readbmp_wiol( $IO );
+ if ( !defined($self->{IMG}) ) {
+ $self->{ERRSTR}='unable to read bmp image';
+ return undef;
+ }
+ $self->{DEBUG} && print "loading a bmp file\n";
+ }
+
if ( $input{type} eq 'raw' ) {
my %params=(datachannels=>3,storechannels=>3,interleave=>1,%input);
# Old code for reference while changing the new stuff
-
if (!$input{type} and $input{file}) {
$input{type}=$FORMATGUESS->($input{file});
}
}
$self->{DEBUG} && print "loading a gif file\n";
}
-
- if ( $input{type} eq 'jpeg' ) {
- if ( !i_writejpeg_wiol($self->{IMG}, $IO, $input{jpegquality})) {
- $self->{ERRSTR}='unable to write jpeg image';
- return undef;
- }
- $self->{DEBUG} && print "writing a jpeg file\n";
- }
-
}
return $self;
}
-
# Write an image to file
-
sub write {
my $self = shift;
my %input=(jpegquality=>75, gifquant=>'mc', lmdither=>6.0, lmfixed=>[],
fax_fine=>1, @_);
my ($fh, $rc, $fd, $IO);
- my %iolready=( tiff=>1, raw=>1, png=>1, pnm=>1 ); # this will be SO MUCH BETTER once they are all in there
+ my %iolready=( tiff=>1, raw=>1, png=>1, pnm=>1, bmp=>1, jpeg=>1 ); # this will be SO MUCH BETTER once they are all in there
unless ($self->{IMG}) { $self->{ERRSTR}='empty input image'; return undef; }
return undef;
}
$self->{DEBUG} && print "writing a png file\n";
+ } elsif ( $input{type} eq 'jpeg' ) {
+ if ( !i_writejpeg_wiol($self->{IMG}, $IO, $input{jpegquality})) {
+ $self->{ERRSTR}='unable to write jpeg image';
+ return undef;
+ }
+ $self->{DEBUG} && print "writing a jpeg file\n";
+ } elsif ( $input{type} eq 'bmp' ) {
+ if ( !i_writebmp_wiol($self->{IMG}, $IO) ) {
+ $self->{ERRSTR}='unable to write bmp image';
+ return undef;
+ }
+ $self->{DEBUG} && print "writing a bmp file\n";
}
if (exists $input{'data'}) {
}
return $self;
} else {
-
if ( $input{type} eq 'gif' ) {
if (not $input{gifplanes}) {
my $gp;
return 'jpeg' if ($ext =~ m/^jpe?g$/);
return 'pnm' if ($ext =~ m/^p[pgb]m$/);
return 'png' if ($ext eq "png");
+ return 'bmp' if ($ext eq "bmp" || $ext eq "dib");
return 'gif' if ($ext eq "gif");
return ();
}
Filter Arguments
autolevels lsat(0.1) usat(0.1) skew(0)
+ bumpmap bump elevation(0) lightx lighty st(2)
contrast intensity
conv coef
gaussian stddev
gradgen xo yo colors dist
hardinvert
noise amount(3) subtype(0)
+ postlevels levels(10)
radnoise xo(100) yo(100) ascale(17.0) rscale(0.02)
turbnoise xo(0.0) yo(0.0) scale(10.0)
+ watermark wmark pixdiff(10) tx(0) ty(0)
The default values are in parenthesis. All parameters must have some
value but if a parameter has a default value it may be omitted when
truncate the range by the specified fraction at the top and bottom of
the range respectivly..
+=item bumpmap
+
+uses the channel I<elevation> image I<bump> as a bumpmap on your
+image, with the light at (I<lightx>, I<lightty>), with a shadow length
+of I<st>.
+
=item contrast
scales each channel by I<intensity>. Values of I<intensity> < 1.0
(I<xo>, I<yo>), I<ascale> controls the angular scale of the noise ,
and I<rscale> the radial scale, higher numbers give more detail.
+=item postlevels
+
+alters the image to have only I<levels> distinct level in each
+channel.
+
=item turbnoise
renders Perlin turbulent noise. (I<xo>, I<yo>) controls the origin of
the noise, and I<scale> the scale of the noise, with lower numbers
giving more detail.
+=item watermark
+
+applies I<wmark> as a watermark on the image with strength I<pixdiff>,
+with an origin at (I<tx>, I<ty>)
+
=back
-A demonstration of the the filters can be found at:
+A demonstration of most of the filters can be found at:
http://www.develop-help.com/imager/filters.html
Where applicable, the ("name") is the name of that field from the GIF89
standard.
-The following ares are set in a TIFF image when read, and can be set
+The following tags are set in a TIFF image when read, and can be set
to control output:
=over
=back
+The following tags are set when reading a Windows BMP file is read:
+
+=over
+
+=item bmp_compression
+
+The type of compression, if any.
+
+=item bmp_important_colors
+
+The number of important colors as defined by the writer of the image.
+
+=back
+
Some standard tags will be implemented as time goes by:
=over