view release on metacpan or search on metacpan
lib/Image/Magick/Tiler.pm view on Meta::CPAN
package Image::Magick::Tiler;
use strict;
use warnings;
use File::Spec;
use Image::Magick;
use Moo;
use Types::Standard qw/Any ArrayRef Int Str/;
lib/Image/Magick/Tiler.pm view on Meta::CPAN
$self -> geometry("$g[0]$g[1]$g[2]$g[3]$g[4]$g[5]$g[6]");
$self -> geometry_set([$g[0], $g[1], $g[2], $g[3], $g[4], $g[5], $g[6] ]);
if ($self -> verbose)
{
print "Image::Magick: V @{[$Image::Magick::VERSION || 'undef']}\n";
print "Image::Magick::Tiler: V $Image::Magick::Tiler::VERSION\n";
print "Geometry: $g parsed as NxM+x+y = " . $self -> geometry . "\n";
}
}
else
{
lib/Image/Magick/Tiler.pm view on Meta::CPAN
# -----------------------------------------------
sub tile
{
my($self) = @_;
my($image) = Image::Magick -> new();
my($result) = $image -> Read($self -> input_file);
die "Error. Unable to read file $self -> input_file. Image::Magick error: $result\n" if ($result);
my(@g) = @{$self -> geometry_set};
my($param) = {};
$$param{image} = {};
($$param{image}{width}, $$param{image}{height}) = $image -> Get('width', 'height');
lib/Image/Magick/Tiler.pm view on Meta::CPAN
die "Error. Unable to clone image $output_file_name\n" if (! ref $tile);
$result = $tile -> Crop(x => $x, y => $y, width => $$param{tile}{width}, height => $$param{tile}{height});
die "Error. Unable to crop image $output_file_name. Image::Magick error: $result\n" if ($result);
push @{$output},
{
file_name => $output_file_name,
image => $tile,
lib/Image/Magick/Tiler.pm view on Meta::CPAN
__END__
=head1 NAME
Image::Magick::Tiler - Slice an image into NxM tiles
=head1 Synopsis
This program ships as scripts/synopsis.pl:
lib/Image/Magick/Tiler.pm view on Meta::CPAN
use strict;
use warnings;
use File::Spec;
use Image::Magick::Tiler;
# ------------------------
my($temp_dir) = '/tmp';
my($tiler) = Image::Magick::Tiler -> new
(
input_file => File::Spec -> catdir('t', 'sample.png'),
geometry => '3x4+5-6',
output_dir => $temp_dir,
output_type => 'png',
lib/Image/Magick/Tiler.pm view on Meta::CPAN
Aslo, try running: perl scripts/tile.pl -h.
=head1 Description
C<Image::Magick::Tiler> is a pure Perl module.
=head1 Distributions
This module is available both as a Unix-style distro (*.tgz) and an
ActiveState-style distro (*.ppd). The latter is shipped in a *.zip file.
lib/Image/Magick/Tiler.pm view on Meta::CPAN
See http://savage.net.au/Perl-modules/html/installing-a-module.html for
help on unpacking and installing each type of distro.
=head1 Constructor and initialization
new(...) returns a C<Image::Magick::Tiler> object.
This is the class contructor.
Parameters:
lib/Image/Magick/Tiler.pm view on Meta::CPAN
Example: '4x5+10-6' is returned as [4, 'x', 5, '+', 10, '-', 6].
=head2 new()
Returns a object of type C<Image::Magick::Tiler>.
See above, in the section called 'Constructor and initialization'.
=head2 output_dir([$str])
lib/Image/Magick/Tiler.pm view on Meta::CPAN
See L</output_type([$str])> to change the output file type.
=item o image
This is the Image::Magick object for one tile.
=back
=head2 verbose([$int])
lib/Image/Magick/Tiler.pm view on Meta::CPAN
=head1 Support
Email the author, or log a bug on RT:
L<https://rt.cpan.org/Public/Dist/Display.html?Name=Image::Magick::Tiler>.
=head1 Author
C<Image::Magick::Tiler> was written by Ron Savage I<E<lt>ron@savage.net.auE<gt>> in 2005.
L<Homepage|http://savage.net.au/>
=head1 Copyright
view all matches for this distribution
view release on metacpan or search on metacpan
FromLatLong.pm view on Meta::CPAN
our $VERSION = 0.12;
our $DATE = "Thu 17 November 18:50 2004";
use 5.006;
use strict;
use warnings;
use Image::Magick;
use File::Basename;
use Data::Dumper;
use Config;
FromLatLong.pm view on Meta::CPAN
#
# Just loads the map specified in the FILE field of MAP array
# field specified by the calling object's MAP field.
#
sub _load_map { my $self=shift;
$self->{IM} = Image::Magick->new;
my $err = $self->{IM}->Read($MAPS{$self->{MAP}}->{FILE});
warn "Load map error: $err ($!)" if $err;
return $err? undef:1;
}
FromLatLong.pm view on Meta::CPAN
scalar file name of Mercator Projection map.
=item DIM
anon array of dimensions of map in pixels [x,y].
You could create DIM on the fly using C<Image::Magick>, but there's probably no point, as you're
almost certainly going to have to edit the map to align it with longitude and latitude
(if you find a stock of public-domain maps that are already aligned, please drop
the author a line).
=item SPOTSIZE
FromLatLong.pm view on Meta::CPAN
=item 1.2
Corrected a slight mis-positioning of points.
Replaced GD with Image::Magick as I was seeing terrible JPEG output
with GD.
Replaced support for non-maintained C<Image::GD::Thumbnail> with
C<Image::Thumbnail>; evaluate a require of this at run time rather
than using the apparently still shakey pragmas.
FromLatLong.pm view on Meta::CPAN
=back
=head1 SEE ALSO
perl(1); L<Image::Magick|http://www.ImageMagick.org> (C<http://www.ImageMagick.org>); L<File::Basename>; L<Acme::Pony>; L<Data::Dumper>; L<WWW::MapBlast>; L<Image::Thumbnail>
=head1 THANKS
Thanks to the London.pm group for their test data and insipration, to Leon for his patience with all that mess on the list, to Philip Newton for his frankly amazing knowledge of international postcodes.
view all matches for this distribution
view release on metacpan or search on metacpan
FromPostcode.pm view on Meta::CPAN
=item 1.2
Corrected a slight mis-positioning of points.
Replaced GD with Image::Magick as I was seeing terrible JPEG output
with GD.
Replaced support for non-maintained C<Image::GD::Thumbnail> with
C<Image::Thumbnail>.
FromPostcode.pm view on Meta::CPAN
=head1 SEE ALSO
perl(1);
L<Image::Maps::Plot::FromLatLong>;
L<Image::Magick|http://www.ImageMagick.org> (C<http://www.ImageMagick.org>); L<File::Basename>; L<Acme::Pony>; L<Data::Dumper>; L<WWW::MapBlast>; L<Image::Thumbnail>
=head1 THANKS
Thanks to the London.pm group for their test data and insipration, to Leon for his patience with all that mess on the list, to Philip Newton for his frankly amazing knowledge of international postcodes.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Match.pm view on Meta::CPAN
use Image::Match
See L<Prima::X11> for more information.
If you need to use other image backends than Prima, that can be done too.
There is L<Prima::Image::Magick> that brings together Prima and ImageMagick,
and there is L<Prima::Image::PDL>, that does the same for PDL. GD, Imglib2, and
Imager, those we can't deal much with, except for saving to and loading from png
files.
=head1 SEE ALSO
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Mate.pm view on Meta::CPAN
$GMOD = "";
@GMODS = (
"Imager",
"GD",
"Image::Magick",
);
%GMODLIST = ();
foreach my $module (@GMODS) {
my $exist = &_CheckForModule($module);
$GMODLIST{$module} = $exist;
lib/Image/Mate.pm view on Meta::CPAN
if ($input{blank}) {
my $truecolour = 0;
$truecolour = 1 if $input{blank}->{c};
$IMGS->{$imgid} = GD::Image->new($input{blank}->{x},$input{blank}->{y},$truecolour);
unless (ref($IMGS->{$imgid})) {
croak 'Image::Magick Error creating image';
} #unless
$self->{X} = $input{blank}->{x};
$self->{Y} = $input{blank}->{y};
} #if
else {
lib/Image/Mate.pm view on Meta::CPAN
croak $@ if $@;
($self->{X},$self->{Y}) = $IMGS->{$imgid}->getBounds()
} #else
} #if
## Image::Magick
if ($GMOD eq "Image::Magick") {
if ($input{blank}) {
if ($input{blank}->{c}) {
$IMGS->{$imgid} = Image::Magick->new(size=>"$input{blank}->{x}x$input{blank}->{y}", type=>'TrueColor');
} #if
else {
$IMGS->{$imgid} = Image::Magick->new(size=>"$input{blank}->{x}x$input{blank}->{y}");
} #else
unless (ref($IMGS->{$imgid})) {
croak 'Image::Magick Error creating image';
} #unless
$self->{X} = $input{blank}->{x};
$self->{Y} = $input{blank}->{y};
my $x = $IMGS->{$imgid}->ReadImage('xc:white');
croak $x if $x;
} #if
else {
$IMGS->{$imgid} = Image::Magick->new;
my $error = $IMGS->{$imgid}->Read($input{file});
croak $error if $error;
($self->{X},$self->{Y}) = $IMGS->{$imgid}->Get('width','height') or croak 'Image::Magick Cannot get width and height';
} #else
} #if
$self->{IMGID} = $imgid;
lib/Image/Mate.pm view on Meta::CPAN
my $colour = &_MakeGDColour($self->{IMGID},$input{c});
$IMGS->{$self->{IMGID}}->filledRectangle(0,0,$self->{X}-1,$self->{Y}-1,$colour);
croak $@ if $@;
} #if
## Image::Magick
if ($GMOD eq "Image::Magick") {
my $error = $IMGS->{$self->{IMGID}}->Colorize(fill => $input{c});
croak $error if $error;
} #if
return $self;
} #sub
lib/Image/Mate.pm view on Meta::CPAN
$IMGS->{$self->{IMGID}}->line($input{start}->{x},$input{start}->{y},$input{end}->{x},$input{end}->{y},$colour);
croak $@ if $@;
$IMGS->{$self->{IMGID}}->setThickness(1) if ($input{thick});
} #if
## Image::Magick
if ($GMOD eq "Image::Magick") {
$input{thick} = 1 unless $input{thick};
my $error = $IMGS->{$self->{IMGID}}->Draw(stroke=>$input{c}, primitive=>'line', points=>"$input{start}->{x},$input{start}->{y} $input{end}->{x},$input{end}->{y}", strokewidth=>$input{thick});
croak $error if $error;
} #if
return $self;
lib/Image/Mate.pm view on Meta::CPAN
} #else
} #else
close(OUTF);
} #if
## Image::Magick
if ($GMOD eq "Image::Magick") {
if ($input{type} eq "gif") {
my $error = $IMGS->{$self->{IMGID}}->Write($input{filename});
croak $error if $error;
} #if
elsif ($input{type} eq "png") {
lib/Image/Mate.pm view on Meta::CPAN
# Get available graphics modules
my %list = &Image::Mate->im_available("hash");
# Set new preference list
my $error = &Image::Mate->im_setpref("Imager","GD","Image::Magick");
# create a new image
$img = Image::Mate->new(blank => {x => 100, y => 100, c => 1});
$img = Image::Mate->new(file => "image.jpg");
lib/Image/Mate.pm view on Meta::CPAN
you set. This routine can be exported the local namespace using use Image::Mate qw( im_available );
=item B<$error = Image::Mate-E<gt>im_setpref(LIST)>
This method allows you to set the preference list of which graphics modules you should use first.
The default is "Imager","GD","Image::Magick". If successful 0 will be returned, otherwise it'll be
an error code with descriptive error. You cannot set modules that are not available. If you are
unsure what graphics modules you have available run Image::Mate->available first.
This routine can be exported the local namespace using use Image::Mate qw( im_setpref );
=item B<$img = Image::Mate-E<gt>new(blank => {x => 100, y => 100, c => 1])>
lib/Image/Mate.pm view on Meta::CPAN
For JPG you can define QUALITY as 0-100 (100 best quality, 0 worest). For PNG you can define
COMPRESSION as 0-9 (0 best quality, 9 worest).
=back
=head1 Obtaining the GD, Imager and Image::Magick perl modules
They are all available on CPAN. Just run a search http://search.cpan.org
As long as you have any one of these modules installed Image::Mate will work.
On linux I recommend using the CPAN module. Type "perl -MCPAN -e shell;" from
your shell. (If this is the first time you've ran the CPAN module you'll have to
go through a little config first, but don't worry this is menu driven). Then type either
(or all):-
install Imager
install GD
install Image::Magick
On Windows your are probably using ActivePerl from ActiveState (which I also recommend). Use their ppm
utility, from the command prompt type:-
ppm install http://ppd.develop-help.com/ppd/Imager.ppd
ppm install http://theoryx5.uwinnipeg.ca/ppms/GD.ppd
ppm install http://www.bribes.org/perl/ppm/Image-Magick.ppd
Unfortunately, ActiveStates automatic build machine does not include the necessary modules to build
Imager, GD and Image::Magick, so they are not available from their default repository.
=head1 BUGS AND LIMITATIONS
This is the first release and distinctly lacking in features :(
Although I'll be adding new features as time goes on :)
lib/Image/Mate.pm view on Meta::CPAN
=head1 SEE ALSO
L<Imager>,
L<GD>,
L<Image::Magick>
=cut
1;
view all matches for this distribution
view release on metacpan or search on metacpan
INSTALL.imagemagick view on Meta::CPAN
# ===================
#
# Installing the proper imagemagick deps can be tricky.
yum -y install ImageMagick-perl
cpan Image::Magick
view all matches for this distribution
view release on metacpan or search on metacpan
bench/benchmark.pl view on Meta::CPAN
my $file = $ARGV[0] || 'images/M31.jpg';
die "File $file not found" unless -f $file;
print "Benchmarking using $file\n";
my @libs = qw/Image::Imlib2 GD Image::Magick Imager/;
foreach my $lib (@libs) {
next unless eval "require $lib;";
print "$lib hash rate: ";
my $start = Time::HiRes::time();
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Pngslimmer.pm view on Meta::CPAN
second.
=head2 Functions
Call Image::Pngslimmer::discard_noncritical($blob) on a stream of bytes
(eg as created by Perl Magick's Image::Magick package) to remove sections of
the PNG that are not essential for display.
Do not expect this to result in a big saving - the author suggests maybe
200 bytes is typical - but in an environment such as the backend of J2ME
applications that may still be a worthwhile reduction.
lib/Image/Pngslimmer.pm view on Meta::CPAN
Adrian McMenamin <adrian AT mcmen DOT demon DOT co DOT uk>
=head1 SEE ALSO
Image::Magick
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
Processor.pm view on Meta::CPAN
#'Image::Processor::Interface::Web',
);
use vars ('$VERSION');
use Image::Magick;
$VERSION = '0.6';
sub process {
my ($self) = @_;
Processor.pm view on Meta::CPAN
my ($self,$file) = @_;
my($image, $x);
print "Creating image " . $self->percent . "% the size of $file\n";
$image = Image::Magick->new;
$x = $image->Read($self->source_directory . "/$file");
warn "$x" if "$x";
$x = $image->Resize('geometry' => $self->percent ."%" );
warn "$x" if "$x";
my $suffix = $self->suffix();
Processor.pm view on Meta::CPAN
the latest imagemagick dll's and PerlMagick. PerlMagick is available
via ActiveStates PPM utility, but I have not tested with that version.
Processing is SLOW (2-5 seconds per CD image), due in part to the
fact that the images are very large by default on the CD and
partly because Image::Magick I believe is slow.
=head2 EXPORT
None this is all OOP.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/QRCode/Effects.pm view on Meta::CPAN
use warnings;
our $VERSION = '0.01';
use File::Slurp qw(write_file);
use Image::Magick;
use Imager;
use Imager::QRCode;
use File::Temp qw(tempfile);
use Params::Validate qw(:all);
use Scalar::Util qw(looks_like_number);
lib/Image/QRCode/Effects.pm view on Meta::CPAN
corner_threshold => { regex => qr/^\d+%,\d+%$/, default => '42%,58%' },
shadow_colour => { %$rx_colour, default => '#000000' },
gradient_type => { regex => qr/^(normal|radial|plasma)$/, default => 'normal' },
});
my $im = Image::Magick->new;
my $size = $p{size};
my $file = $self->{file};
if (!-f "$file") {
die "Internal error: file $file has not been set";
lib/Image/QRCode/Effects.pm view on Meta::CPAN
else {
die "Colour required";
}
# create a blank image to fill
my $white = Image::Magick->new;
$white->Set(size => $size);
$white->ReadImage('xc:white');
# fill with the colour, masked with the barcode
my $filled = Image::Magick->new;
$filled->Set(size => $size);
$filled->ReadImage($fill);
$im->Negate();
$white->Composite(image => $filled, mask => $im, color => 'white');
lib/Image/QRCode/Effects.pm view on Meta::CPAN
=head1 SEE ALSO
L<Imager::QRCode>
L<Image::Magick>
=head1 AUTHOR
Mike Cartmell, C<< <mcartmell at cpan.org> >>
view all matches for this distribution
view release on metacpan or search on metacpan
examples/correct.pl view on Meta::CPAN
#
# So you can use this script for batch correction of photographs.
use strict;
use warnings;
use Image::Magick; # image stuff
use lib 'lib';
use Image::Photo; # quality image sampling of photos
if ($#ARGV ne 5)
{
examples/correct.pl view on Meta::CPAN
"e.g. $0 0.0 -0.02 0.0 10.0 input.jpg output.jpg\n";
}
my ($a, $b, $c, $radlum, $in_file, $out_file) = @ARGV;
# sort out inputImage::Magick object
my $in = new Image::Magick;
$in->ReadImage ($in_file);
# we are going to have the same size for the output image
my $width = $in->Get ('width');
my $height = $in->Get ('height');
print STDERR "Image is $width"."x"."$height.\n";
# all this just creates a blank Image::Magick canvas
my $out = new Image::Magick (size => $width ."x". $height);
$out->ReadImage ("NULL:Black");
$out->Transparent (color => 'black');
# create objects for reading and writing
examples/correct.pl view on Meta::CPAN
}
print STDERR "#";
}
print STDERR "\n";
# Convert from the RGBA blob back to an Image::Magick object
$outrgba->Image->Write ($out_file);
1;
view all matches for this distribution
view release on metacpan or search on metacpan
Resizes images using GD graphics library
=head1 DESCRIPTION
Despite its heavy weight, I've always used L<Image::Magick|Image::Magick> for creating image thumbnails. I know it can be done using lighter-weight L<GD|GD>, I just never liked its syntax. Really, who wants to remember the lengthy arguments list of c...
$image->copyResampled($sourceImage,$dstX,$dstY,
$srcX,$srcY,$destW,$destH,$srcW,$srcH);
when L<Image::Magick|Image::Magick> lets me say:
$image->Scale(-geometry=>'250x250');
Image::Resize is one of my attempts to make image resizing easier, more intuitive using L<GD|GD>.
=head1 CREDITS
Thanks to Paul Allen <paul.l.allen AT comcast.net> for the C<trueColor(1)> tip. Now Image::Resize should work fine for photographs too.
Thanks to Nicholas Venturella <nick2588 AT gmail.com> for allowing Image::Resize to work with already-opened L<GD::Image|GD> objects and for checking the scaling routine. It's now comparable to L<Image::Magick|Image::Magick>'s C<Scale()>: the resulti...
=head1 SEE ALSO
L<GD>, L<Image::Magick>
=head1 AUTHOR
Sherzod B. Ruzmetov, E<lt>sherzodr@cpan.orgE<gt>
http://author.handalak.com/
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Scale.pm view on Meta::CPAN
resize_gm_fixed_point 2.07/s (0.483 s/iter) (63x faster than floating-point!)
=head1 SEE ALSO
L<GD>,
L<Image::Magick>,
L<Imager>
=head1 AUTHOR
Andy Grundman, E<lt>andy@hybridized.orgE<gt>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Seek.pm view on Meta::CPAN
sub add_image {
my ($image, $id) = @_;
if (UNIVERSAL::isa($image, "Imager")) { goto &add_image_imager }
if (UNIVERSAL::isa($image, "Image::Imlib2")) { goto &add_image_imlib2 }
if (UNIVERSAL::isa($image, "GD::Image")) { goto &add_image_gd }
if (UNIVERSAL::isa($image, "Image::Magick")) { goto &add_image_magick }
croak "Don't know what sort of image $image is";
}
sub add_image_magick {
my ($img, $id) = @_;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/ImageShoehorn.pm view on Meta::CPAN
=item *
Convert I<(On|Off)>
If an image fails a validity test, then the image will be be converted using the first type defined by the I<SetValid> configs that the package (read: Image::Magick) can understand.
=item *
ScaleAllOnCleanup I<(On|Off)>
lib/Apache/ImageShoehorn.pm view on Meta::CPAN
if (exists($TYPES{$apache->location()}->{$2})) {
return $TYPES{$apache->location()}->{$2};
}
if (! @FORMATS) {
@FORMATS = Image::Magick->QueryFormat();
}
$TYPES{$apache->location()}->{$2} = grep(/^($2)$/,@FORMATS);
return $TYPES{$apache->location()}->{$2};
}
view all matches for this distribution
view release on metacpan or search on metacpan
Image/Signature/ColorHistogram.pm view on Meta::CPAN
package Image::Signature::ColorHistogram;
use strict;
our $VERSION = '0.01';
use Image::Magick;
use Image::Signature::Vars;
sub color_histogram {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Size.pm view on Meta::CPAN
}
$LAST_POS = 0;
# Right now, $x, $y and $id are undef. If the while-loop below doesn't
# match the header to a file-type and call a subroutine, then the later
# block that tried Image::Magick will default to setting the id/error to
# "unknown file type".
my $tm_idx = 0;
while ($tm_idx < @TYPE_MAP)
{
if ($header =~ $TYPE_MAP[$tm_idx])
lib/Image/Size.pm view on Meta::CPAN
if (! defined $id)
{
if ($file_name)
{
# Image::Magick operates on file names.
($x, $y, $id) = imagemagick_size($file_name);
}
else
{
$id = 'Data stream is not a known image file format';
lib/Image/Size.pm view on Meta::CPAN
sub imagemagick_size
{
my $file_name = shift;
my $module_name;
# First see if we have already loaded Graphics::Magick or Image::Magick
# If so, just use whichever one is already loaded.
if (exists $INC{'Graphics/Magick.pm'})
{
$module_name = 'Graphics::Magick';
}
elsif (exists $INC{'Image/Magick.pm'})
{
$module_name = 'Image::Magick';
}
# If neither are already loaded, try loading either one.
elsif (_load_magick_module('Graphics::Magick'))
{
$module_name = 'Graphics::Magick';
}
elsif (_load_magick_module('Image::Magick'))
{
$module_name = 'Image::Magick';
}
if ($module_name)
{
my $img = $module_name->new();
my $x = $img->Read($file_name);
# Image::Magick error handling is a bit weird, see
# <http://www.simplesystems.org/ImageMagick/www/perl.html#erro>
if("$x") {
return (undef, undef, "$x");
} else {
return ($img->Get('width', 'height', 'format'));
lib/Image/Size.pm view on Meta::CPAN
else {
return (undef, undef, 'Data stream is not a known image file format');
}
}
# load Graphics::Magick or Image::Magick if one is not already loaded.
sub _load_magick_module {
my $module_name = shift;
my $retval = eval {
local $SIG{__DIE__} = q{};
require $module_name;
lib/Image/Size.pm view on Meta::CPAN
=item CUR (Microsoft mouse cursor format)
=back
Additionally, if the B<Image::Magick> module is present, the file types
supported by it are also supported by Image::Size. See also L<"CAVEATS">.
When using the C<imgsize> interface, there is a third, unused value returned
if the programmer wishes to save and examine it. This value is the identity of
the data type, expressed as a 2-3 letter abbreviation as listed above. This is
useful when operating on open file handles or in-memory data, where the type
is as unknown as the size. The two support routines ignore this third return
value, so those wishing to use it must use the base C<imgsize> routine.
Note that when the B<Image::Magick> fallback is used (for all non-natively
supported files), the data type identity comes directly from the 'format'
parameter reported by B<Image::Magick>, so it may not meet the 2-3 letter
abbreviation format. For example, a WBMP file might be reported as
'Wireless Bitmap (level 0) image' in this case.
=head2 Information Caching and C<$NO_CACHE>
lib/Image/Size.pm view on Meta::CPAN
file handles and scalar references cannot be reliably transformed into a
unique key for the table of cache data. Buffers could be cached using the
MD5 module, and perhaps in the future I will make that an option. I do not,
however, wish to lengthen the dependency list by another item at this time.
As B<Image::Magick> operates on file names, not handles, the use of it is
restricted to cases where the input to C<imgsize> is provided as file name.
=head1 SEE ALSO
L<Image::Magick|Image::Magick> and L<Image::Info|Image::Info> Perl modules at
CPAN. The B<Graphics::Magick> Perl API at
L<http://www.graphicsmagick.org/perl.html>.
=head1 CONTRIBUTORS
lib/Image/Size.pm view on Meta::CPAN
<aweslowski@rpinteractive.com>, who also provided a test image. PCD support
was adapted from a script made available by Phil Greenspun, as guided to my
attention by Matt Mueller I<mueller@wetafx.co.nz>. A thorough read of the
documentation and source by Philip Newton I<Philip.Newton@datenrevision.de>
found several typos and a small buglet. Ville Skytt� I<(ville.skytta@iki.fi)>
provided the MNG and the Image::Magick fallback code. Craig MacKenna
I<(mackenna@animalhead.com)> suggested making the cache available so that it
could be used with shared memory, and helped test my change before release.
=head1 BUGS
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Thumbnail.pm view on Meta::CPAN
# With Image Magick
my $t = new Image::Thumbnail(
size => "55x75",
create => 1,
module => "Image::Magick",
input => $imageObject,
outputpath => 'test_t.jpg',
);
# Create a thumbnail from 'test.jpg' as 'test_t.jpg'
lib/Image/Thumbnail.pm view on Meta::CPAN
In the experience of the author, thumbnails are created fastest
with direct use of the L<Image::Epeg> module.
=head1 PREREQUISITES
One of C<Image::Magick>, C<Imager>, L<Image::Epeg>, or C<GD>.
=head1 CONSTRUCTOR new
Parameters are supplied as a hash or hash-like list of name/value pairs:
See the L</SYNOPSIS>.
lib/Image/Thumbnail.pm view on Meta::CPAN
=head2 OPTIONAL PARAMETERS
=over 4
=item module ( GD | Image::Magick | Imager | Image::JPEG)
If you wish to use a specific module, place its name here.
You must have the module you require already installed!
Supplying no name will allow ImageMagick, then Imager to be tried before GD.
lib/Image/Thumbnail.pm view on Meta::CPAN
}
croak "You cannot supply both an 'object' field and a 'inputpath' field" if $t>1;
croak "You must supply either an 'object' field or a 'inputpath' field" if $t==0;
# Try not to limit Image::Magick...
if ($self->{inputpath}
and $self->{module} and $self->{module} =~ /^(GD|GD::Image)$/
and not -e $self->{inputpath}){
croak "The supplied inputpath '$self->{inputpath}' does not exist:\n$!"
}
# Correct common user errors
if ($self->{module} and $self->{module} =~ /^ImageMagick$/i){
$self->{module} = 'Image::Magick';
warn "Corrected parameter 'module' from 'ImaegMagick' to 'Image::Magick'" if $self->{CHAT};
}
# Sort out the Thumbnail module
if (not $self->set_mod){
$self->{error} = "No module found with which to make a thumbnail";
lib/Image/Thumbnail.pm view on Meta::CPAN
elsif ($try){
$self->{module} = $try;
}
elsif (not $self->{module} and not $try){
for (qw( Image::Epeg Image::Magick Imager GD )){
warn "# Try $_" if $self->{CHAT};
if (not $self->set_mod($_)){
next;
return undef;
} else {
lib/Image/Thumbnail.pm view on Meta::CPAN
}
import GD;
warn "# GD OK" if $self->{CHAT};
}
elsif ($self->{module} eq 'Image::Magick'){
warn "# Requiring Image::Magick" if $self->{CHAT};
eval { require Image::Magick };
if ($@){
$self->{error} = "Error requring Image::Magick:\n".$@;
return undef;
}
import Image::Magick;
warn "# Image::Magick OK" if $self->{CHAT};
}
elsif ($self->{module} eq 'Imager'){
warn "# Requiring Imager ..." if $self->{CHAT};
eval { require Imager };
lib/Image/Thumbnail.pm view on Meta::CPAN
my $r;
warn "# Creating thumbnail" if $self->{CHAT};
if ($self->{module} eq 'Image::Epeg'){
$r = $self->create_epeg;
}
elsif ($self->{module} eq 'Image::Magick'){
$r = $self->create_imagemagick;
}
elsif ($self->{module} eq 'Imager'){
$r = $self->create_imager;
}
lib/Image/Thumbnail.pm view on Meta::CPAN
#
# METHOD create_imagemagick
#
sub create_imagemagick { my $self=shift;
warn "#...with Image::Magick" if $self->{CHAT};
if (not $self->{object} or ref $self->{object} ne 'Image::Magick'){
warn "#...from file $self->{inputpath}" if $self->{CHAT};
$self->{object} = Image::Magick->new;
if ($self->{inputblob}) {
$self->{object}->BlobToImage( ${$self->{input}} );
}
elsif ($self->{inputpath}){
$self->{error} = $self->{object}->Read($self->{inputpath});
lib/Image/Thumbnail.pm view on Meta::CPAN
if ($self->{outputpath}){
warn "# Writing to $self->{outputpath}" if $self->{CHAT};
$_ = $self->{object}->Write($self->{outputpath});
$self->set_errors($_);
}
warn "# Done Image::Magick: ",$self->{x}," ",$self->{y} if $self->{CHAT};
return 1;
}
#
# METHOD create_gd
lib/Image/Thumbnail.pm view on Meta::CPAN
#
# For PerlMagick: Interpret $s for errors and put in warnings/errors field
#
sub set_errors { my ($self,$s) = (shift,shift);
if ($self->{module} eq 'Image::Magick'){
if ($s =~ /(\d+)/){
if ($1 <400){
$self->{warning} = $s;
} else {
$self->{error} = $s;
lib/Image/Thumbnail.pm view on Meta::CPAN
L<perl>,
L<Image::Epeg>,
L<GD>,
L<Imager>,
L<Image::Magick>,
L<Image::Magick::Thumbnail>,
L<Image::GD::Thumbnail>,
L<Image::Epeg>.
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Tileset.pm view on Meta::CPAN
package Image::Tileset;
use strict;
use warnings;
use Image::Magick;
use XML::Simple;
use Data::Dumper;
our $VERSION = '0.01';
lib/Image/Tileset.pm view on Meta::CPAN
my $self = {
debug => 0, # Debug mode
xml => '', # XML file
spec => [], # Spec data (XML data in Perl form)
image => '', # Image file
magick => undef, # Image::Magick object
error => '', # Last error state
tiles => {}, # Tile positions in tileset
animations => {}, # Animation information
@_,
};
bless ($self,$class);
$self->{magick} = Image::Magick->new;
# If given an image, load it.
if (length $self->{image}) {
$self->image ($self->{image});
$self->{image} = '';
lib/Image/Tileset.pm view on Meta::CPAN
return $self->{error};
}
=head2 bool image (string filepath)
Load an image file with C<Image::Magick>. The object is just kept in memory for
when you actually want to get a tile from it.
Returns 1 on success, undef on error.
=cut
lib/Image/Tileset.pm view on Meta::CPAN
if (!-e $image) {
$self->error("Can't load image file $image: file not found!");
return undef;
}
# Load it with Image::Magick.
my $x = $self->{magick}->Read($image);
if ($x) {
warn $x;
return undef;
}
lib/Image/Tileset.pm view on Meta::CPAN
}
=head2 bool data (bin data)
If your program already has the image's binary data in memory, it can send it
directly to this function. It will create an C<Image::Magick> object based off
the binary data directly, instead of needing to read a file from disk.
Returns 1 on success, undef on error.
=cut
sub data {
my ($self,$data) = @_;
# Load it with Image::Magick.
my $x = $self->{magick}->BlobToImage($data);
if ($x) {
warn $x;
return undef;
}
lib/Image/Tileset.pm view on Meta::CPAN
return 1;
}
=head2 void clear ()
Clear the internal C<Image::Magick> object, unloading the tileset.
=cut
sub clear {
my $self = shift;
undef $self->{magick};
$self->{magick} = new Image::Magick();
}
=head2 bool xml (string xmldata | string specfile)
Load a specification file from XML. Pass either XML data or the path to a
lib/Image/Tileset.pm view on Meta::CPAN
int scale: Scale the tile before returning its data. This is a number to
scale it by, for example '2' returns it at 200% its original size,
while '0.5' returns it at 50% its original size.
str size: Resize the tile to this exact size before returning it, for
example '64x64'.
bool magick: If true, returns the Image::Magick object instead of the binary
data. If you want to make additional modifications to the image
(i.e. edit its colors, apply special effects), use the 'magick'
option and then apply the effects yourself.
The options C<scale> and C<size> are mutually exclusive.
lib/Image/Tileset.pm view on Meta::CPAN
return $self->{animations}->{$id};
}
=head2 ImageMagick slice (string id)
Returns an C<Image::Magick> object that contains the sliced tile from the
original tileset. This is mostly for internal use only.
=cut
sub slice {
lib/Image/Tileset.pm view on Meta::CPAN
return $slice;
}
=head1 SEE ALSO
L<Image::Magick|Image::Magick>, which powers this module's graphics handling.
L<XML::Simple|XML::Simple>, which powers this module's XML parsing.
=head1 CHANGES
view all matches for this distribution
view release on metacpan or search on metacpan
L<Affix::Infix2Postfix>(3), L<Parse::RecDescent>(3)
Other perl imaging modules include:
L<GD>(3), L<Image::Magick>(3),
L<Graphics::Magick|http://www.graphicsmagick.org/perl.html>(3),
L<Prima::Image>, L<IPA>.
For manipulating image metadata see L<Image::ExifTool>.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Konstrukt/Plugin/wiki/backend/image/DBI.pm view on Meta::CPAN
use strict;
use warnings;
use base 'Konstrukt::Plugin::wiki::backend::image';
use Image::Magick;
=head1 METHODS
=head2 new
lib/Konstrukt/Plugin/wiki/backend/image/DBI.pm view on Meta::CPAN
$result = $dbh->selectall_arrayref($query, { Columns=>{} });
if (@{$result}) {
#resize the image
my $image = $result->[0];
#load image
my $im = Image::Magick->new();
$im->BlobToImage($image->{content});
#resize
my ($old_width, $old_height) = $im->Get('width', 'height');
my $aspect = $old_width / $old_height;
my $height = $width / $aspect;
lib/Konstrukt/Plugin/wiki/backend/image/DBI.pm view on Meta::CPAN
if (defined $content) {
#get current entry and check if the new entry differs
my $current = $self->get_content($title);
if (not defined $current->{content} or $current->{content} ne $content) {
#load image
my $im = Image::Magick->new();
$im->BlobToImage($content);
#successfully loaded?
if (defined $im->[0]) {
#get mimetype if not defined
$mimetype = $im->Get('MIME') unless defined $mimetype;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Kwiki/Attachments.pm view on Meta::CPAN
if ($image->read(file=>$file)) {
my $thumb_img = $image->scale(xpixels=>80,ypixels=>80);
$thumb_img->write(file=>$thumb);
}
}
} elsif (eval { require Image::Magick }) {
# Image::Magick does the right thing with image files regardless
# of whether the file extension looks like ".jpg", ".png" etc.
my $image = Image::Magick->new;
return unless ref($image);
if (!$image->Read($file)) {
if (!$image->Scale(geometry=>'80x80')) {
if (!$image->Contrast(sharpen=>"true")) {
$image->Write($thumb);
lib/Kwiki/Attachments.pm view on Meta::CPAN
=head3 B<General>
Kwiki::Attachments gives a Kwiki wiki the ability to upload, store and manage
file attachments on any page. By default, if you have an image creation module
such as Imager or Image::Magick installed, then a thumbnail will be created for
every supported image file type that is uploaded. Thumbnails are displayed on
the attachments page, and can also be displayed on wiki pages via the wafl
directives described in the next paragraph. The thumbnail files have "thumb_"
prepended to the original filename and are not displayed separately in the
attachment page or widget. For this reason, you cannot upload files beginning
lib/Kwiki/Attachments.pm view on Meta::CPAN
This flag controls whether thumbnails are created from uploaded image files.
It is set to 'on' by default.
=item * im_override: [on|off]
If both Imager.pm and Image::Magick.pm are available, Kwiki::Attachments uses
Imager, unless im_override is set to 'on'. This parameter has no effect if only
one of the two image manipulation modules is installed. It is set to 'off' by
default.
=head1 AUTHOR
lib/Kwiki/Attachments.pm view on Meta::CPAN
# make_thumbnails: on|off
make_thumbnails: on
# 'im_override' overrides the preference for Imager for
# thumbnail creation if both Imager & Image::Magick are installed.
# im_override: on|off
im_override: off
__css/attachments.css__
table.attachments {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Kwiki/UserPhoto.pm view on Meta::CPAN
return unless ref($image);
$image->read(file=>$file);
my $thumb_img = $image->scale(xpixels=>$width,ypixels=>$height);
$thumb_img->write(file=>$thumb);
}
} elsif (eval { require Image::Magick }) {
my $image = Image::Magick->new;
return unless ref($image);
if (!$image->Read($file)) {
if (!$image->Scale(geometry=>"${width}x${height}")) {
if (!$image->Contrast(sharpen=>"true")) {
$image->Write($thumb);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/LaTeXML/Post/LaTeXImages.pm view on Meta::CPAN
# is even needed.
# This test is called once we know that, from within
#
# At any rate: To process LaTeX snippets into images, we will need
# * latex (or related) from a TeX installation
# * Image::Magick (or similar) [see LaTeXML::Util::Image]
sub canProcess {
my ($self) = @_;
# Check if we have Image::Magick (or similar)
if (!image_can_image()) {
Error('expected', 'Image::Magick', undef,
"No available image processing module found; Skipping.",
"Please install one of: " . join(',', image_classes()));
return; }
# AND check if we have an approriprate latex!!!
if (($LATEXCMD =~ /^(\S+)/) && !which($1)) { # does the command seem to be available?
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Labyrinth/DIUtils/ImageMagick.pm view on Meta::CPAN
#############################################################################
#Modules/External Subroutines #
#############################################################################
use Image::Magick;
#############################################################################
#Subroutines
#############################################################################
lib/Labyrinth/DIUtils/ImageMagick.pm view on Meta::CPAN
die "no image specified" if !$image;
die "no image file found" if !-f $image;
# read in current image
my $i = Image::Magick->new();
die "object image error: [$image]\n" if !$i;
my $c = $i->Read($image);
die "read image error: [$image] $c\n" if $c;
my $atts = {
lib/Labyrinth/DIUtils/ImageMagick.pm view on Meta::CPAN
__END__
=head1 SEE ALSO
L<Image::Magick>,
L<Labyrinth>,
L<Labyrinth::DIUtils::GD>
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
vhost/toolkit/thumbnails.pl view on Meta::CPAN
#############################################################################
#Modules/External Subroutines #
#############################################################################
use Carp;
use Image::Magick;
use lib qw|../cgi-bin/lib ../cgi-bin/plugins|;
use Labyrinth::Globals;
use Labyrinth::Variables;
vhost/toolkit/thumbnails.pl view on Meta::CPAN
next unless(-f $source);
unlink $target if(-f $target);
# read in current image
my $i = Image::Magick->new();
croak "object image error: [$source]" if !$i;
my $c = $i->Read($source);
croak "read image error: [$source] $c" if $c;
$c = $i->AutoOrient();
croak "orient image error: [$source] $c" if $c;
view all matches for this distribution
view release on metacpan or search on metacpan
"HTTP::Message" : "0",
"Hash::Merge::Simple" : "0",
"IO::Socket::Timeout" : "0",
"IO::String" : "0",
"IPC::Run" : "0",
"Image::Magick" : "0",
"LWP::Protocol::PSGI" : "0",
"LWP::Protocol::https" : "0",
"LWP::UserAgent" : "0",
"Lasso" : "v2.3.0",
"List::MoreUtils" : "0",
"Glib" : "0",
"HTML::FormatText::WithLinks" : "0",
"HTTP::Message" : "0",
"IO::Socket::Timeout" : "0",
"IPC::Run" : "0",
"Image::Magick" : "0",
"LWP::Protocol::https" : "0",
"LWP::UserAgent" : "0",
"Lasso" : "v2.3.0",
"List::MoreUtils" : "0",
"MIME::Entity" : "0",
view all matches for this distribution
view release on metacpan or search on metacpan
t/folders/mbox.cpy view on Meta::CPAN
Content-Length: 1095
Lines: 25
* Pletschette Andre (andre.pletschette@gmx.net) [000509 15:11]:
> When I tried to write a perl script with the following line in it:
> use Image::Magick;
> I get the following error-message:
>
> perl: error in loading shared librairies:
> /usr/lib/perl5/site_perl/5.005/i586-lin
> ux/auto/Image/Magick/Magick.so: undefined symbol: SetWarningHandler
>
> Could anybody tell me what this means, and how I can get it run, I run
> Suse Linux 6.3 and I've installed Image Magick with the C++ and the Perl
> Modules.
The Perl::Magick and Image::Magick/ImageMagick modules are not compatible.
Just reinstall all yourself from www.ImageMagick.org.
Be warned: you have to remove the old Perl::Magick *.pm files too, otherwise
you may still use the old versions...
--
t/folders/mbox.cpy view on Meta::CPAN
X-Status: A
Content-Length: 747
Lines: 19
When I tried to write a perl script with the following line in it:
use Image::Magick;
I get the following error-message:
perl: error in loading shared librairies:
/usr/lib/perl5/site_perl/5.005/i586-lin
ux/auto/Image/Magick/Magick.so: undefined symbol: SetWarningHandler
view all matches for this distribution
view release on metacpan or search on metacpan
t/2011-12-07.mkd.t view on Meta::CPAN
ê·¸ë¦¬ê³ ê·¸ ì´ìì í´ìëì íë©´ì ì¬ì©íë¤ë©´ 5MBë ê°ë³ê² íì© ëê¹ëë¤.
본격ì ì¼ë¡ ëë 캡ì³ë¥¼ íë ¤ê³ ìê°íëë°, ì´ë¬ë©´ ì¢ ê³¤ëíê² ì£ .
BMP ëì PNG íì¼ í¬ë§·ì ì¬ì©í´ì ì©ë 문ì 를 í´ê²°íëë¡ íê² ìµëë¤.
BMP를 PNGë¡ ë³ííë ë°©ë²ì ë¤ìí©ëë¤.
CPANì L<GD 모ë|https://metacpan.org/module/GD>, L<Image::Magick|https://metacpan.org/module/Image::Magick>,
L<Imager|https://metacpan.org/module/Imager>ë ë¬¼ë¡ ì´ê³ C<Win32::GUI> 모ëì ë¸ë ¤ ëì¤ë
[Win32::GUI::DIBitmap][cpan-win32-gui-dbbitmap] 모ëì ì¬ì©íë ë±
ì¬ë¬ê°ì§ ë°©ë²ì´ ììµëë¤.
ë¤ë§ ê°ê°ì 모ëì 모ë ìëì°ì¦ì ììí 문ì ë¤ì´ ììµëë¤.
C<GD> 모ëì ê²½ì° BMP í¬ë§·ì ì§ìíì§ ìì¼ë©°,
C<Image::Magick>ë ë°ë¡ ë°ì´ë리 ë¼ì´ë¸ë¬ë¦¬ë¥¼ ì¤ì¹í í CPAN 모ëì
ì¤ì¹í´ì¼ íë¯ë¡ ì´ë³´ìì ê²½ì° ì ê·¼ì´ ì´ë µìµëë¤.
ëí C<Imager>ë BMP를 ì§ìíì§ë©´ ê²°ì ì ì¼ë¡ ìëì°ì¦ìì
캡ì³í ë ìì±ëë BMP íì(ë§)ì ì§ìíì§ ììµëë¤.
ë§ì§ë§ì¼ë¡ C<Win32::GUI::DIBitmap> 모ëì ê²½ì° ActivePerlì ê²½ì° ë¬¸ì ìì´
ì¬ì©ì´ ê°ë¥íë ë¸ê¸°í ì¬ì©ìì ê²½ì° ì»´íì¼ë¬ í¸í 문ì ë¡ ì¤ì¹ëì§ ìì
view all matches for this distribution
view release on metacpan or search on metacpan
eg/Apache2Handler.pm view on Meta::CPAN
use Apache::Session;
use MasonX::Request::WithApache2Session;
use DBI;
use Data::Dumper;
use Image::Magick;
use Date::Format;
use Net::IP::CMatch;
use HTML::Lint;
}
view all matches for this distribution