i_color_set
i_color_info
- i_img_empty
- i_img_empty_ch
- i_img_exorcise
- i_img_destroy
-
i_img_info
i_img_setmask
if ($ex_version < 5.57) {
@ISA = qw(Exporter);
}
- $VERSION = '0.90';
+ $VERSION = '0.93';
require XSLoader;
XSLoader::load(Imager => $VERSION);
}
$self->{IMG} = i_img_16_new($hsh{xsize}, $hsh{ysize}, $hsh{channels});
}
else {
- $self->{IMG}=Imager::ImgRaw::new($hsh{'xsize'}, $hsh{'ysize'},
- $hsh{'channels'});
+ $self->{IMG}= i_img_8_new($hsh{'xsize'}, $hsh{'ysize'},
+ $hsh{'channels'});
}
unless ($self->{IMG}) {
return 1;
}
else {
- my $work = $@ || "Unknown error loading $file";
+ my $work = $@ || "Unknown error";
chomp $work;
$work =~ s/\n?Compilation failed in require at .*Imager\.pm line .*\z//m;
$work =~ s/\n/\\n/g;
+ $work =~ s/\s*\.?\z/ loading $file/;
$file_load_errors{$file} = $work;
$$error = $work;
return 0;
}
}
elsif (defined $opts{radians} || defined $opts{degrees}) {
- my $amount = $opts{radians} || $opts{degrees} * 3.1415926535 / 180;
+ my $amount = $opts{radians} || $opts{degrees} * 3.14159265358979 / 180;
my $back = $opts{back};
my $result = Imager->new;
sub setsamples {
my $self = shift;
- my %opts = ( x => 0, offset => 0, @_ );
unless ($self->{IMG}) {
$self->_set_error('setsamples: empty input image');
return;
}
- my $data = $opts{data};
- unless(defined $data) {
+ my %opts = ( x => 0, offset => 0 );
+ my $data_index;
+ # avoid duplicating the data parameter, it may be a large scalar
+ my $i = 0;
+ while ($i < @_ -1) {
+ if ($_[$i] eq 'data') {
+ $data_index = $i+1;
+ }
+ else {
+ $opts{$_[$i]} = $_[$i+1];
+ }
+
+ $i += 2;
+ }
+
+ unless(defined $data_index) {
$self->_set_error('setsamples: data parameter missing');
return;
}
+ unless (defined $_[$data_index]) {
+ $self->_set_error('setsamples: data parameter not defined');
+ return;
+ }
my $type = $opts{type};
defined $type or $type = '8bit';
my $count;
if ($type eq '8bit') {
$count = i_psamp($self->{IMG}, $opts{x}, $opts{y}, $opts{channels},
- $data, $opts{offset}, $width);
+ $_[$data_index], $opts{offset}, $width);
}
elsif ($type eq 'float') {
$count = i_psampf($self->{IMG}, $opts{x}, $opts{y}, $opts{channels},
- $data, $opts{offset}, $width);
+ $_[$data_index], $opts{offset}, $width);
}
elsif ($type =~ /^([0-9]+)bit$/) {
my $bits = $1;
- unless (ref $data) {
+ unless (ref $_[$data_index]) {
$self->_set_error("setsamples: data must be an array ref for type not 8bit or float");
return;
}
$count = i_psamp_bits($self->{IMG}, $opts{x}, $opts{y}, $bits,
- $opts{channels}, $data, $opts{offset},
+ $opts{channels}, $_[$data_index], $opts{offset},
$width);
}
else {
$new->{IMG} = i_convert($self->{IMG}, $matrix);
unless ($new->{IMG}) {
# most likely a bad matrix
+ i_push_error(0, "convert");
$self->{ERRSTR} = _error_as_msg();
return undef;
}
i_get_image_file_limits();
}
+my @check_args = qw(width height channels sample_size);
+
+sub check_file_limits {
+ my $class = shift;
+
+ my %opts =
+ (
+ channels => 3,
+ sample_size => 1,
+ @_,
+ );
+
+ if ($opts{sample_size} && $opts{sample_size} eq 'float') {
+ $opts{sample_size} = length(pack("d", 0));
+ }
+
+ for my $name (@check_args) {
+ unless (defined $opts{$name}) {
+ $class->_set_error("check_file_limits: $name must be defined");
+ return;
+ }
+ unless ($opts{$name} == int($opts{$name})) {
+ $class->_set_error("check_file_limits: $name must be a positive integer");
+ return;
+ }
+ }
+
+ my $result = i_int_check_image_file_limits(@opts{@check_args});
+ unless ($result) {
+ $class->_set_error($class->_error_as_msg());
+ }
+
+ return $result;
+}
+
# Shortcuts that can be exported
sub newcolor { Imager::Color->new(@_); }
L<Imager::ExtUtils> - tools to get access to Imager's C API.
+=item *
+
+L<Imager::Security> - brief security notes.
+
=back
=head2 Basic Overview
box() - L<Imager::Draw/box()> - draw a filled or outline box.
+check_file_limits() - L<Imager::Files/check_file_limits()>
+
circle() - L<Imager::Draw/circle()> - draw a filled circle
close_log() - L<Imager::ImageTypes/close_log()> - close the Imager
L<Imager::Engines/"Matrix Transformations">,
L<Imager::Font/transform()>
-metadata, image - L<Imager::ImageTypes/"Tags">
+metadata, image - L<Imager::ImageTypes/"Tags">, L<Image::ExifTool>
mosaic - L<Imager::Filters/mosaic>
scaling - L<Imager::Transformations/scale()>
+security - L<Imager::Security>
+
SGI files - L<Imager::Files/"SGI (RGB, BW)">
sharpen - L<Imager::Filters/unsharpmask>, L<Imager::Filters/conv>
L<GD>(3), L<Image::Magick>(3), L<Graphics::Magick>(3),
L<Prima::Image>, L<IPA>.
+For manipulating image metadata see L<Image::ExifTool>.
+
If you're trying to use Imager for array processing, you should
probably using L<PDL>.