view release on metacpan or search on metacpan
lib/Image/BoxModel.pm view on Meta::CPAN
#Inheritance is granted by using the appropriate backend-modules.
#This means that if GD is used, then the image-object has ::Backend::GD as its parent, so therefore the appropriate methods in ::Backend::GD are found.
#I don't know if this is good software design..
if ($image -> {lib} eq "IM"){
require Image::Magick;
require Image::BoxModel::Backend::IM;
push @ISA, "Image::BoxModel::Backend::IM";
$image->{IM} = new Image::Magick;
$image->{IM} -> Set(size => ($image->{width}+1)."x".($image->{height}+1)); #IM calculates "human-style" 800x400 is from 0 to 799 and 0 to 399 :-) we do width-- and height-- because we don't do human style in this module.
$image->{IM} -> Read("xc:$image->{background}");
}
elsif ($image -> {lib} eq "GD"){
require GD;
lib/Image/BoxModel.pm view on Meta::CPAN
=head2 OBJECTIVES
Have a way to draw things on images using the same code with different libraries.
Use OO-style design to make the implementation of new library backends (library wrappers) easy. Image::Magick and GD present at the moment.
Use a box model to cut the original image into smaller rectangles. Afterwards objects can be drawn onto these boxes.
=head2 ANOTHER IMAGING / CHARTING / WHATEVER MODULE?
lib/Image/BoxModel.pm view on Meta::CPAN
This module will try hard to make the life of the user easier and the life of the developer more fun.
It has backends for graphic libraries so that you can draw images using the same code with different libraries.
Example: One user (me ;-) starts writing a perl script which produces some charts.
Because Image::Magick is common to me, I use it. After some time I find out that GD would be much faster and is able to do everything I need.
I have to rewrite much of my code because GD does many things different from how IM does them.
..And now someone tells me about the Imager-module from the CPAN!
With this module it is (should be) possible to just replace $image->{lib} in the constructor method and keep the rest of the code.
lib/Image/BoxModel.pm view on Meta::CPAN
If you want to write portable code, you have to stick with the following things: (Portability between OSes and between backend libs)
=head3 Don't use fontconfig
You can profit from the wonderful possibilties offered by fontconfig, if you use this module on a system with fontconfig and GD as backend lib.
Anyhow, if you change the backend to Image::Magick later or take your code to a system without fontconfig, it will produce errors.
Perhaps these considerations will lead to removing fontconfig support from Image::BoxModel. Perhaps 'font' will be mandatory for 'Text' and 'Annotate'.
Perhaps there will be a possibilty to specify a default font.
=head3 Copy the font files into your projects directory tree
lib/Image/BoxModel.pm view on Meta::CPAN
It is possible to use every method of the chosen library through the objects library-object:
$image->{IM} -> Edge(radius => "10");
This of course only works with Image::Magick. First, because there will be no {IM} if using GD und second, because GD doesn't know about 'Edge'.
On the other hand, this code will only work with GD:
$image->{GD} -> arc(50,50,95,75,0,360,$image->Colors(color=>'blue'));
There may be cases in which you will want to use library-specific code. Image::BoxModel doesn't implement all features of all libraries. Besides, this would be quite difficult.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/ButtonMaker.pm view on Meta::CPAN
Image::ButtonMaker was developed as a part of a large scale web
application with multiple language support, themes and products.
Image::ButtonMaker B<requires> Image::Magick with TrueType Font
support to run.
=head1 MAIN PRINCIPLES
Each button has a set of different attributes, which determine the
view all matches for this distribution
view release on metacpan or search on metacpan
demos/curses.pl view on Meta::CPAN
use strict;
use lib '../lib';
use Curses;
use Term::ReadKey;
use Image::Caa;
use Image::Magick;
#
# load the image
#
my $image = Image::Magick->new;
my $x = $image->Read('kitten.jpg');
warn "$x" if "$x";
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/CairoSVG.pod view on Meta::CPAN
=item L<Image::LibRSVG>
Perl extension for a Gnome library called librsvg which converts SVG
to PNG or JPEG, etc. We have not tested this library.
=item L<Image::Magick>
Does SVG to PNG conversion.
=item L<Image::SVG::Path>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/ColorDetector.pm view on Meta::CPAN
detect
);
use Carp ();
use Image::Magick;
use List::Util qw( max min );
sub detect {
my ($file_path) = @_;
lib/Image/ColorDetector.pm view on Meta::CPAN
sub _extract_hsv {
my ($img) = @_;
$img or return;
my $im = Image::Magick->new;
open(IMAGE, $img);
my $ret = $im->Read(file => \*IMAGE);
if ($ret) {
view all matches for this distribution
view release on metacpan or search on metacpan
benchmark/simple.pl view on Meta::CPAN
use warnings;
use Image::Epeg qw(:constants);
use Benchmark ':all';
use GD;
use Imager;
use Image::Magick;
print "# Image::Epeg $Image::Epeg::VERSION\n";
print "# Imager $Imager::VERSION\n";
print "# GD $GD::VERSION\n";
print "# Image::Magick $Image::Magick::VERSION\n";
my $srcfile = shift or die "Usage: $0 fname";
my $src = Image::Epeg->new($srcfile);
print "# origsize: @{[ $src->get_width ]} x @{[ $src->height ]}\n";
my $width = int($src->get_width * 0.4);
benchmark/simple.pl view on Meta::CPAN
};
}
qw/copyResized copyResampled/
),
imagemagick => sub {
my $img = Image::Magick->new;
$img->Read($srcfile);
$img->Resize(
width => $width,
height => $height,
);
$img->Write('imagemagick.jpg');
},
"imagemagick-lanczos" => sub {
my $img = Image::Magick->new;
$img->Read($srcfile);
$img->Resize(
width => $width,
height => $height,
filter => 'Lanczos',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Fixup.pm view on Meta::CPAN
use base qw/Class::Light/;
use Carp;
use Image::ExifTool;
use Image::Magick;
$VERSION = '0.01002';
=head1 NAME
lib/Image/Fixup.pm view on Meta::CPAN
sub _init {
my $self = shift;
my $path = shift;
my $prefix = defined $_[0] ? shift : 'fixed_';
my $image = Image::Magick->new;
my $exif = Image::ExifTool->new;
my ($base, $file) = ($path =~ /(.*)\/(.*)/);
$base = $path unless $base;
$file = $base unless $file;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Grab.pm view on Meta::CPAN
bless ($self, $class);
$self->ua(new Image::Grab::RequestAgent);
$self->{have_DigestMD5} = eval {require Digest::MD5};
$self->{have_MD5} = eval {require MD5;};
$self->{have_magick} = eval {require Image::Magick;};
return $self;
}
sub AUTOLOAD {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Hash.pm view on Meta::CPAN
=head1 DESCRIPTION
Image::Hash allows you to calculate the average hash, difference hash and perception hash an image.
Depending on what is available on your system Image::Hash will use GD, Image::Magick or Imager to interact with your image.
=head1 CONSTRUCTOR METHODS
lib/Image/Hash.pm view on Meta::CPAN
if ($self->{'module'}) {
# Try to load the image handler the user asked for
if ($self->{'module'} eq "GD") {
require GD;
}
elsif ($self->{'module'} eq "ImageMagick" || $self->{'module'} eq "Image::Magick") {
require Image::Magick;
$self->{'module'} = 'ImageMagick';
}
elsif ($self->{'module'} eq "Imager") {
require Imager;
}
lib/Image/Hash.pm view on Meta::CPAN
else {
# Try to load GD, ImageMagic or Imager
if (eval 'require GD') {
$self->{'module'} = "GD";
}
elsif (eval 'require Image::Magick') {
$self->{'module'} = "ImageMagick";
}
elsif (eval 'require Imager') {
$self->{'module'} = "Imager";
}
lib/Image/Hash.pm view on Meta::CPAN
$self->{'reduse'} = \&reduse_GD;
$self->{'pixels'} = \&pixels_GD;
$self->{'blob'} = \&blob_GD;
}
elsif ($self->{'module'} eq 'ImageMagick') {
$self->{'im'} = Image::Magick->new();
my $ret = $self->{'im'}->BlobToImage( $self->{'image'} );
if ($ret == 0) {
carp("Can't make image from this value");
return undef;
}
lib/Image/Hash.pm view on Meta::CPAN
$self->{ $opt{'im'} }->width, $self->{ $opt{'im'} }->height
);
$self->{ $opt{'im'} } = $dest;
}
# Reduse the size of an image using Image::Magick
sub reduse_ImageMagick {
my ($self, %opt) = @_;
$self->{ $opt{'im'} } = $self->{'im'};
$self->{ $opt{'im'} }->Set(antialias=>'True');
lib/Image/Hash.pm view on Meta::CPAN
my ($self, %opt) = @_;
return $self->{ $opt{'im'} }->png;
}
# Return the image as a blob using Image::Magick
sub blob_ImageMagick {
my ($self, %opt) = @_;
my $blobs = $self->{ $opt{'im'} }->ImageToBlob(magick => 'png');
lib/Image/Hash.pm view on Meta::CPAN
}
return @pixels;
}
# Return the pixel values for an image when using Image::Magick
sub pixels_ImageMagick {
my ($self, %opt) = @_;
my ($xs, $ys) = split(/x/, $opt{'geometry'});
my @pixels;
lib/Image/Hash.pm view on Meta::CPAN
Please see the C<eg/> directory for further examples.
=head1 BUGS
Image::Hash support different back ends (GD, Image::Magick or Imager), but because the different back ends work slightly different they will not produce the same hash for the same image. More info is available at https://github.com/runarbu/PerlImageH...
=head1 AUTHOR
Runar Buvik
CPAN ID: RUNARB
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Heatmap.pm view on Meta::CPAN
package Image::Heatmap;
use strict;
use warnings;
use Image::Magick;
our $VERSION = join( '.', 0, sprintf( '%03d', map{ $_ - 47 + 500 } ( '$Rev: 112 $' =~ /(\d+)/g ) ) );
our $DEBUG = 0;
use constant {
lib/Image/Heatmap.pm view on Meta::CPAN
my $max_rep = 0;
my $width = $self->width();
my $height = $self->height();
my $map = Image::Magick->new();
$map->Read( $self->map() );
$self->image_width( $map->Get('width') );
$self->image_height( $map->Get('height') );
# If there is no width/height defined then we will default
lib/Image/Heatmap.pm view on Meta::CPAN
) unless ( defined( $children[-1] ) );
unless ( $children[-1] ) {
note("Resize -geometry ${x_canvas}x${y_canvas}");
my $child_layer = Image::Magick->new( size => "${x_canvas}x${y_canvas}");
$child_layer->Read('pattern:gray100');
my $cperc = int( 100 / ( $max_rep || 1 ) );
$cperc /= 2 if ( $cperc > 80 );
note("Colorize -fill white -opacity $cperc%");
my $plot = Image::Magick->new();
$plot->Read( $self->plot_base() );
$plot->Resize( $self->plot_size() ) if ( $self->plot_size() );
$plot->Colorize( fill => 'white', 'opacity' => "$cperc%" );
my @coords = @{ Image::Heatmap::private::get( $self => 'coords' ) || [] };
lib/Image/Heatmap.pm view on Meta::CPAN
note("Blocking wait on pid:$child");
my $pid_state = waitpid( $child, 0 );
note("pid:$child - $pid_state :: $?");
}
my $layer = Image::Magick->new( size => "${x_canvas}x${y_canvas}");
$layer->Read('pattern:gray100');
foreach my $child_num ( 1 .. $kids ) {
my $child_image = $self->tmp_dir() . sprintf( $kid_layer, $child_num );
my $child_slice = Image::Magick->new();
$child_slice->Read($child_image);
note("Composite -image $child_image -compose Multiply -geometry +0+0");
$layer->Composite(
'image' => $child_slice,
lib/Image/Heatmap.pm view on Meta::CPAN
=head1 SEE ALSO
=over
=item L<Image::Magick>
=item L<File::Find>
=back
view all matches for this distribution
view release on metacpan or search on metacpan
RasterCaption.pm view on Meta::CPAN
use vars qw/$VERSION/;
$VERSION = 0.1;
=head1 NAME
Image::IPTCInfo::RasterCaption - get/set IPTC raserized caption w/Image::Magick
=head1 SYNOPSIS
use Image::IPTCInfo::RasterCaption;
RasterCaption.pm view on Meta::CPAN
October 1997, Page 41
=cut
use Image::Magick;
use Image::IPTCInfo;
push @ISA, 'Image::IPTCInfo';
use Carp;
use strict;
RasterCaption.pm view on Meta::CPAN
#
# SUB _blank_canvas
# Returns a plain white canvas of the standard size
#
sub _blank_canvas {
my $image = new Image::Magick;
$image = Image::Magick->new;
$image->Set(size=>'460x128');
$image->ReadImage('xc:white');
return $image;
}
RasterCaption.pm view on Meta::CPAN
Writes to the file specified in the sole argument
the rasterized caption stored in the object's IPTC
field of the same name.
Image creation is via C<Image::Magick> so see L<Image::Magick>
for further details.
On failure returns C<undef>.
On success returns the path written to.
RasterCaption.pm view on Meta::CPAN
sub load_raster_caption { my ($self,$path,$threshold) = (shift, shift,shift);
croak "load_raster_caption requires a 'path' paramter" if not $path;
$threshold = 127 if not defined $threshold;
croak "Threshold param must be 1-255" if $threshold<1 or $threshold>255;
my $image = new Image::Magick;
my $err = $image->Read($path);
if ($err){
carp "Could not read file $path: $!";
return undef;
}
RasterCaption.pm view on Meta::CPAN
Fills the rasterized caption with binary data representing
supplied text.
This is very elementry: no font metrics what so ever,
just calls C<Image::Magick>'s C<Annotate>
with the text supplied in the first argument, using the
point size specified in the second argument, and the font
named in the third.
If no size is supplied, defaults to 12 points.
If no font is supplied, then C<arialuni.ttf> is looked
for in the C<fonts> directory beneath the directory specified
in the environment variable C<SYSTEMROOT>. Failing that, the
ImageMagick default is used - YMMV. See the I<Annotate> method
in L<Image::Magick> (C<imagemagick.org>) for details.
On failure carps and returns C<undef>
On success returns a referemce to a scalar containing
the rasterized caption.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/JpegCheck.pm view on Meta::CPAN
=head1 DESCRIPTION
Image::JpegCheck is jpeg file checker for perl.
Yes, I know. I know the L<Imager>, L<GD>, L<Image::Magick>, L<Image::Size>,
etc.But, I need tiny one. I want to use this module in the mod_perl =)
Code is taken from L<Image::Size>, and optimized it.
=head1 FUNCTIONS
view all matches for this distribution
view release on metacpan or search on metacpan
bin/kim_category_images view on Meta::CPAN
use Image::Kimdaba;
use English qw( -no_match_vars ) ;
print "Checking if you have convert from ImageMagick package\n";
my $res=system("which convert");
die "You need to install Image::Magick module and ImageMagieck" unless $res==0;
my $folder=getRootFolder();
print "Parsing the ${folder}/index.xml database...\n";
parseDB( "$folder" );
view all matches for this distribution
view release on metacpan or search on metacpan
package Image::Magick::Brand;
use strict;
use warnings;
use Carp;
require Image::Magick;
our $VERSION = '0.01';
sub new {
my $class = shift;
warn "Format : $format\n";
}
eval {
my $im_s = new Image::Magick;
my $im_t = new Image::Magick;
my $err;
open(IMAGE,"<$source") or carp "Could not open source image: $source ($!)" and return undef;
$err = $im_s->Read(file=>\*IMAGE);
1;
__END__
=head1 NAME
Image::Magick::Brand - Perl extension for creating branded images with ImageMagick.
=head1 SYNOPSIS
use Image::Magick::Brand;
my $b = new Image::Magick::Brand;
$b->debug(1); # debugging statements on
# Required parameters
$b->brand( source => 'brand.png',
| | + | | = | +--+ |
+--+ +---------+ +---------+
=head1 PREREQUISITES
C<Image::Magick>
=cut
=head1 PARAMETERS
Version 0.01 (03 May 2005): Initial Revision
=head1 SEE ALSO
L<Image::Magick>
L<Image::Magick::Thumbnail::Fixed>
http://imagemagick.org/script/perl-magick.php
=head1 AUTHOR
view all matches for this distribution
view release on metacpan or search on metacpan
examples/test-chart.pl view on Meta::CPAN
#!/usr/bin/env perl
use strict;
use warnings;
use Image::Magick::Chart::HorizontalBars;
# -----------------------
Image::Magick::Chart::HorizontalBars -> new
(
antialias => 0, # 0 => No antialias; 1 => Antialias.
bar_width => 8, # Pixels.
bg_color => 'white',
colorspace => 'RGB',
examples/test-chart.pl view on Meta::CPAN
y_axis_labels_option => 1, # 0 => None; 1 => Draw them.
y_axis_ticks_option => 1, # 0 => None; 1 => Left of y-axis; 2 => Across frame.
y_pixels_per_unit => 20,
) -> draw();
Image::Magick::Chart::HorizontalBars -> new
(
antialias => 0, # 0 => No antialias; 1 => Antialias.
bar_width => 8, # Pixels.
bg_color => 'white',
colorspace => 'RGB',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Magick/CommandParser.pm view on Meta::CPAN
package Image::Magick::CommandParser;
use strict;
use warnings;
use warnings qw(FATAL utf8); # Fatalize encoding glitches.
lib/Image/Magick/CommandParser.pm view on Meta::CPAN
=pod
=head1 NAME
C<Image::Magick::CommandParser> - Parse any command line acceptable to convert or mogrify
=head1 Synopsis
This is scripts/synopsis.pl:
lib/Image/Magick/CommandParser.pm view on Meta::CPAN
use strict;
use warnings;
use warnings qw(FATAL utf8);
use Image::Magick::CommandParser;
# ----------------------------------------------
my($command) = 'convert colors/*s*.png -append output.png';
my($processor) = Image::Magick::CommandParser -> new
(
command => $command,
maxlevel => 'notice',
);
lib/Image/Magick/CommandParser.pm view on Meta::CPAN
Input: convert colors/*s*.png -append output.png
Result: convert colors/fuchsia.png colors/silver.png -append output.png
=head1 Description
C<Image::Magick::CommandParser> is a stand-alone parser for command lines acceptable to the
L<Imagemagick|https://imagemagick.org> programs C<convert> and C<mogrify>.
It aims to handle all constructs supported by Imagemagick itself, but it's vital to understand
that this module does not use any component of Imagemagick. Hence the I<stand-alone> just above.
lib/Image/Magick/CommandParser.pm view on Meta::CPAN
module does not support one of those features. But see L</Trouble-shooting> before reporting an
issue, since there I list a few special cases.
=head1 Installation
Install C<Image::Magick::CommandParser> as you would for any C<Perl> module:
Run:
cpanm Image::Magick::CommandParser
or run:
sudo cpan Image::Magick::CommandParser
or unpack the distro, and then:
perl Makefile.PL
make (or dmake or nmake)
make test
make install
=head1 Constructor and Initialization
Call C<new()> as C<< my($parser) = Image::Magick::CommandParser -> new(k1 => v1, k2 => v2, ...) >>.
It returns a new object of type C<Image::Magick::CommandParser>.
Key-value pairs accepted in the parameter list (see also the corresponding methods
[e.g. L</command([$string])>]):
=over 4
lib/Image/Magick/CommandParser.pm view on Meta::CPAN
=head1 Trouble-shooting
=head2 Installation failure
I had a failure when installing the module on my laptop for the 1st time. The problem was that,
somehow, during the installation of L<Image::Magick>, root had become the owner of a directory
under the control of perlbrew. To fix this, I had to do:
sudo chown ron:ron /home/ron/perl5/perlbrew/perls/perl-5.20.2/lib/site_perl/5.20.2/x86_64-linux/auto/Image/Magick
=head2 Regions specified as '@100000' are not supported
lib/Image/Magick/CommandParser.pm view on Meta::CPAN
=head1 See Also
L<Imager>
L<Image::Magick::Chart>
L<Image::Magick::PolyText>
L<Image::Magick::Tiler>
L<Set::Array>
L<Set::FA::Element>
lib/Image/Magick/CommandParser.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::CommandParser>.
=head1 Author
C<Image::Magick::CommandParser> was written by Ron Savage I<E<lt>ron@savage.net.auE<gt>> in 2016.
My homepage: L<http://savage.net.au/>
=head1 Copyright
view all matches for this distribution
view release on metacpan or search on metacpan
package Image::Magick::Info;
use strict;
use warnings;
use Carp;
require Image::Magick;
require Exporter;
use AutoLoader qw(AUTOLOAD);
our @ISA = qw(Exporter);
our @EXPORT_OK = qw( get_info );
our $VERSION = '0.03';
my $im = new Image::Magick;
sub get_info{
my ($filename, @info ) = @_;
if( ref $filename eq "GLOB" || ref $filename eq "IO::File" ){
__END__
=head1 NAME
Image::Magick::Info - Retreive image attributes with Image::Magick.
=head1 SYNOPSIS
use Image::Magick::Info qw( get_info );
my $info = get_info("/users/aroth/Desktop/photo.jpg", ("filesize","width","height") );
my $info = get_info( $FILE_HANDLE, ("filesize") );
my $info = get_info( \*FILE, ("width","height") );
L<Image::Size>
L<Image::Info>
L<Image::Magick::Thumbnail::Fixed>
L<Image::Magick::Brand>
=head1 AUTHOR
Adam Roth, E<lt>aroth@cpan.orgE<gt>
=cut
L<Image::Info>
L<Image::Magick::Thumbnail::Fixed>
L<Image::Magick::Brand>
=head1 AUTHOR
Adam Roth, E<lt>aroth@cpan.orgE<gt>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Magick/Iterator.pm view on Meta::CPAN
=head1 NAME
Image::Magick::Iterator - sequentially read Image::Magick object from
a filehandle.
=head1 SYNOPSIS
use strict;
use Image::Magick::Iterator;
my $iter = Image::Magick::Iterator->new();
#assume PPM stream is coming from STDIN;
$iter->handle(\*STDIN);
#explicitly set format to PPM, there is no auto-detection built in
$iter->format('PPM');
while(my $image = $iter->next){
print $image->Get('height'),"\n"; #access height attribute of each
#Image::Magick object
}
=head1 DESCRIPTION
Image::Magick::Iterator adds iteration support to
L<Image::Magick|Image::Magick>. This means that if you have a stream
of concatenated images, you can access each image in the stream as an
independent L<Image::Magick|Image::Magick> object.
Iteration functionality is not present in
L<Image::Magick|Image::Magick> itself as of version 5.56. Passing a
stream of concatenated images would result in essentially a "stack" of
images which would all be manipulated in parallel by any
L<Image::Magick|Image::Magick> calls. Calls to Write() either output
an animated series of image (a la animated GIFs), or the first image
in the series.
Image::Magick::Iterator is extensible to support many different image
filetypes. Currently only PPM support is implemented. See
L</SYNOPSIS|SYOPSIS> for an example.
=head1 SUPPORTED FORMATS
Currently only PPM images can be iterated. It's not difficult to add
new image types though, and I'm receptive to new classes for handling
more formats. To add another format:
1. Have a look at the source of
L<Image::Magick::Iterator::PPM|Image::Magick::Iterator::PPM> to get an
idea of how to write a new format handling class. It is basically a
class with one method, B<read_image>, that when given a filehandle
reference reads an image from it and passes back the raw data.
2. add a mapping to L</_delegate()> that maps the desired value of
lib/Image/Magick/Iterator.pm view on Meta::CPAN
# Let the code begin...
package Image::Magick::Iterator;
use strict;
use base qw();
our $VERSION = '0.01';
use File::Temp;
use Image::Magick;
=head2 new()
=over
=item Usage
my $obj = new Image::Magick::Iterator();
=item Function
Builds a new Image::Magick::Iterator object
=item Returns
an instance of Image::Magick::Iterator
=item Arguments
None
lib/Image/Magick/Iterator.pm view on Meta::CPAN
$obj->init(%arg);
=item Function
Internal method to initialize a new Image::Magick::Iterator object
=item Returns
true on success
lib/Image/Magick/Iterator.pm view on Meta::CPAN
=over
=item Usage
$obj->next(); #get next Image::Magick from stream
=item Function
reads an L<Image::Magick|Image::Magick> object from a filehandle.
=item Returns
a L<Image::Magick|Image::Magick> object, or undef if the filehandle is
EOF or contains only a partial image.
=item Arguments
none, read-only
lib/Image/Magick/Iterator.pm view on Meta::CPAN
return undef unless $raw;
my $tmp = File::Temp->new(UNLINK => 1);
print $tmp $raw;
$image = Image::Magick->new();
close($tmp);
open(IN,"$tmp");
$image->Read(file => \*IN);
lib/Image/Magick/Iterator.pm view on Meta::CPAN
sub _delegate {
my ($self,$format) = @_;
my %map = (
PPM => 'Image::Magick::Iterator::PPM',
);
return $map{$format};
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Magick/NFPADiamond.pm view on Meta::CPAN
package Image::Magick::NFPADiamond;
use 5.00;
use strict "vars";
use strict "subs";
use Image::Magick;
our $VERSION = '1.00';
=head1 Name
Image::Magick::NFPADiamond - This module renders a NFPA diamond using ImageMagick
=head1 Synopsis
use Image::Magick::NFPADiamond;
my $diamond=Image::Magick::NFPADiamond->new(red=>3, blue=>0, yellow=>1);
$diamond->save('warning.jpg');
=head1 Description
This module composes a NFPA diamond or I<fire diamond> image using ImageMagick perl module.
=head1 Methods
=head2 Image::Magick::NFPADiamond::new()
The constructor takes a series of arguments in a hash notation style, none of wich are mandatory:
=over
lib/Image/Magick/NFPADiamond.pm view on Meta::CPAN
#This Perl script will produce a dynamic NFPA alike diamond
use strict "vars";
use strict "subs";
use CGI;
use Image::Magick::NFPADiamond;
my $request=new CGI;
#Using $request->Vars allows for a query_string like 'red=1&blue=2' to work
my $img=Image::Magick::NFPADiamond->new($request->Vars) || die "Fail\n";
print $request->header(-type=> "image/jpeg", -expires=>'+3d');
binmode STDOUT;
$img->response('jpg');
lib/Image/Magick/NFPADiamond.pm view on Meta::CPAN
$size=$params{size};
} else {
$size=320; #Default for size
}
my $canvas=Image::Magick->new(size => $size.'x'.$size);
$canvas->Read('xc:white');
my $self={canvas => $canvas, size=>$size};
bless ($self,$class);
$self->_doit();
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Magick/PixelMosaic.pm view on Meta::CPAN
package Image::Magick::PixelMosaic;
use strict;
use warnings;
our $VERSION = '0.03';
$VERSION = eval $VERSION; # see L<perlmodstyle>
use Image::Magick;
=head1 NAME
Image::Magick::PixelMosaic - Pixelized mosaic filter for Image::Magick.
=head1 SYNOPSIS
use Image::Magick;
use Image::Magick::PixelMosaic;
my $img = Image::Magick->new;
$img->Read('hoge.jpg');
my $pix = Image->Magick::PixelMosaic->new;
$pix->src($img);
# generates 4x4 pixelized mosaic on area (100,120)-(180,160)
$pix->pixelize('80x40+100+120', [4,4]);
=head1 DESCRIPTION
This module generates pixelized mosaic on parts of images using L<Image::Magick>.
=head1 METHODS
=over 3
=item new [src => $obj]
Creates an C<Image::Magick::PixelMosaic> object.
Optional C<src> parameter expects C<Image::Magick> object.
my $pix = Image::Magick::PixelMosaic->new(src => $img);
is equal to
my $pix = Image::Magick::PixelMosaic->new;
$pix->src($img);
=item src, src($obj)
Get or set Image::Magick object.
=item pixelize C<geometry> => I<geometry>, C<pixelsize> => I<pixel width&height>
Generates pixelized mosaic on specified geometry.
lib/Image/Magick/PixelMosaic.pm view on Meta::CPAN
=back
=head1 SEE ALSO
L<Image::Magick>
=head1 TODO
accept width/heigh/x/y options.
lib/Image/Magick/PixelMosaic.pm view on Meta::CPAN
sub src
{
my ($self, $obj) = @_;
if ( $obj ) {
if (!$obj->isa('Image::Magick')) {
die "specified object is not an Image::Magick";
}
$self->{src} = $obj;
}
return $self->{src};
}
lib/Image/Magick/PixelMosaic.pm view on Meta::CPAN
sub pixelize
{
my ($self, %opt) = @_;
if (!$self->{src}) {
die q/source Image::Magick object must be set before calling pixelize()/;
}
my $img = $self->{src};
my ($geo,$psize) = @opt{qw/geometry pixelsize/};
view all matches for this distribution
view release on metacpan or search on metacpan
examples/pt.pl view on Meta::CPAN
#!/usr/bin/env perl
use strict;
use warnings;
use Image::Magick;
use Image::Magick::PolyText;
use Time::Elapsed qw(elapsed);
# ------------------------------------------------
print "Image::Magick::PolyText V $Image::Magick::PolyText::VERSION. \n";
print "\n";
my $start_time = time;
my $x_1 = [100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700];
my $y_1 = [100, 147, 184, 199, 190, 159, 114, 65, 25, 3, 5, 30, 73];
my $x_2 = [100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700];
my $y_2 = [250, 297, 334, 349, 340, 309, 264, 215, 175, 153, 155, 180, 223]; # $y_1[*] + 150.
my $image = Image::Magick -> new(size => '800 x 400');
my $result = $image -> Read('xc:white');
$result = $image -> Set(font => 't/n019003l.pfb');
die $result if $result;
my $polytext_1 = Image::Magick::PolyText -> new
({
debug => 0,
fill => 'Red',
image => $image,
pointsize => 16,
examples/pt.pl view on Meta::CPAN
strokewidth => 1,
text => 'Draw text along a polyline',
x => $x_1,
y => $y_1,
});
my $polytext_2 = Image::Magick::PolyText -> new
({
debug => 0,
fill => 'Red',
image => $image,
pointsize => 16,
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Magick/Safer.pm view on Meta::CPAN
package Image::Magick::Safer;
=head1 NAME
Image::Magick::Safer - Wrap Image::Magick Read method to check magic bytes
=for html
<a href='https://travis-ci.org/Humanstate/image-magick-safer?branch=master'><img src='https://travis-ci.org/Humanstate/image-magick-safer.svg?branch=master' alt='Build Status' /></a>
<a href='https://coveralls.io/r/Humanstate/image-magick-safer?branch=master'><img src='https://coveralls.io/repos/Humanstate/image-magick-safer/badge.png?branch=master' alt='Coverage Status' /></a>
lib/Image/Magick/Safer.pm view on Meta::CPAN
0.08
=head1 SYNOPSIS
use Image::Magick::Safer;
# functions just like Image::Magick but wraps the Read method
# to check the magic bytes of any images using File::LibMagic
my $magick = Image::Magick::Safer->new;
# if any @files have a MIME type that looks questionable then
# $e will be populated
if ( my $e = $magick->Read( @files ) ) {
# bail out, unsafe to continue
....
}
=head1 DESCRIPTION
Image::Magick::Safer is a drop in wrapper around Image::Magick, it adds a
magic byte check to the C<Read> method to check the file MIME type using
L<File::LibMagic>. If a file looks questionable then it will prevent the file
being passed to the real Image::Magick::Read method and return an error.
If a file cannot be opened, because it does not exist or it is prefixed
with a pipe, an error will also be returned.
You can replace any calls to C<Image::Magick> with C<Image::Magick::Safer>
and the functionality will be retained with the added Read protection. The
aliases for C<Read> will also be made safe.
If you need to override the default MIME types then you can set the modules
C<$Image::Magick::Safer::Unsafe> hash to something else or add extra types:
# add SVG check to the defaults
$Image::Magick::Safer::Unsafe->{'image/svg+xml'} = 1;
The default MIME types considered unsafe are as follows:
text/plain
application/x-compress
lib/Image/Magick/Safer.pm view on Meta::CPAN
Also note that to install the L<File::LibMagic> module you will need to have
both the library (libmagic.so) and the header file (magic.h). See the perldoc
for L<File::LibMagic> for more information.
=head1 WHY ISN'T THIS A PATCH IN Image::Magick?
Image::Magick moves at a glacial pace, and involves a 14,000 line XS file. No
thanks. This will probably get patched in the next version, so for the time
being this module exists.
=cut
use strict;
use warnings;
use parent 'Image::Magick';
use File::LibMagic;
our $VERSION = '0.08';
# imagemagick can automatically uncompress archive files so there's another
# attack vector in having an exploit image zipped up, so just checking for
# text/plain isn't enough
$Image::Magick::Safer::Unsafe = {
map { $_ => 1 }
'text/plain',
'application/x-compress',
'application/x-compressed',
'application/gzip',
lib/Image/Magick/Safer.pm view on Meta::CPAN
if ( $info->{mime_type} =~ /No such file or directory/i ) {
return $info->{mime_type};
}
# if the mime_type is within the $Image::Magick::Safer::Unsafe
# hash or we can't figure it out then we assume it's not a real
# image and therefore could have an exploit within the file
if (
! $info->{mime_type}
|| $Image::Magick::Safer::Unsafe->{ $info->{mime_type} }
) {
return "$image is of type @{[ $info->{mime_type} ]}, potentially unsafe";
}
} else {
return "unable to establish mime_type for $image";
}
}
# all images *seem* ok, delegate to the real Image::Magick
return $self->SUPER::Read( @images );
}
# Image::Magick has a few aliases for the Read method
*Image::Magick::Safer::ReadImage = *Image::Magick::Safer::Read;
*Image::Magick::Safer::read = *Image::Magick::Safer::Read;
*Image::Magick::Safer::readimage = *Image::Magick::Safer::Read;
=head1 KNOWN BUGS
DOES NOT WORK with BSD 10.1 and 7.0.1 and i can't figure out why. If you can
figure out why then please submit a pull request. This is possibly some libmagic
weirdness going on.
=head1 SEE ALSO
L<Image::Magick> - the library this module wraps
L<https://www.imagemagick.org> - ImageMagick
L<https://imagetragick.com/> - ImageMagick exploits
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Magick/Square.pm view on Meta::CPAN
package Image::Magick::Square;
use Carp;
use vars qw($VERSION);
use strict;
use warnings;
$VERSION = sprintf "%d.%03d", q$Revision: 1.3 $ =~ /(\d+)/g;
sub import {
*{Image::Magick::Trim2Square} = \&create;
}
# Image Magick Square
# square an image, chop as needed
lib/Image/Magick/Square.pm view on Meta::CPAN
=pod
=head1 NAME
Image::Magick::Square - Takes image and crops trims to a square shape
=head1 SYNOPSIS
use Image::Magick;
use Image::Magick::Square;
# instance and read in image
my $src = new Image::Magick;
$src->Read('source.jpg');
# square it
my $square = Image::Magick::Square::create($src);
# Save it
$square->Write('square.jpg');
use Image::Magick;
use Image::Magick::Square;
my $i = new Image::Magick;
$i->Read('./my.jpg');
$i->Trim2Square;
$i->Write('./squared.jpg');
=head1 EXAMPLE
To make a square thumbnail:
use Image::Magick::Square;
# Load your source image
my $src = new Image::Magick;
$src->Read('source.jpg');
# resize it down some..
my ($thumb,$x,$y) = Image::Magick::Thumbnail::create($src,50);
# crop to biggest square that will fit inside image.
my ($square_thumb,$side) = Image::Magick::Square::create($thumb);
# Save it
$square_thumb->Write('square_thumb.jpg');
lib/Image/Magick/Square.pm view on Meta::CPAN
You can run this conversion on any image magick object.
The subroutine is not exported.
A method is aliased onto Image::Magick::Trim2Square
=head1 SUBS
=head2 Image::Magick::Square::create()
Argument is Image::Magick object.
Trims top and bottom or sides as needed to make it into a square shape.
Returns object.
=head2 Trim2Square()
Is an alias for Image::Magick::Square::create(), it is placed inside the
Image::Magick namespace.
=head1 PREREQUISITES
L<Image::Magick>
=head2 NOTES
Yes, L<Image::Magick::Thumbnail::Fixed> will make a fixed size thumbnail.
It's great, I love it. Except for one thing, it does not take an existing
Image::Magick object to work on. It does too much. It doesn't return an
image object either.
Image::Magick::Square is more a specialized crop then a
"thumbnail subroutine".
This way, you can add more effects, like a shadow, a border, annotate- etc,
I<before> you save or display the image.
=cut
=head2 EXPORT
This basically adds a new method to Image::Magick.
use Image::Magick;
use Image::Magick::Square;
my $i = new Image::Magick;
$i->Read('./my.jpg');
$i->Trim2Square;
If you wish to avoid importing Trim2Square onto the Image::Magick namespace..
use Image::Magick::Square();
=head1 SEE ALSO
L<perl>, L<Image::Magick>, L<Image::GD::Thumbnail>,
L<Image::Magick::Thumbnail>, L<Image::Magick::Thumbnail::Fixed>.
=head1 AUTHOR
Leo Charre leocharre at cpan dot org
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Magick/Stencilize.pm view on Meta::CPAN
package Image::Magick::Stencilize;
use strict;
use vars qw($VERSION);
$VERSION = sprintf "%d.%02d", q$Revision: 1.2 $ =~ /(\d+)/g;
#use Exporter;
lib/Image/Magick/Stencilize.pm view on Meta::CPAN
#@EXPORT = 'Stencilize';
#use Smart::Comments '###';
#Imaeg
#$Image::Magick::
# in the tradition of image magick names:
no strict 'refs';
*Image::Magick::Stencilize = \&Stencilize;
sub Stencilize {
my $self = shift; # image magick object
my $threshold = shift;
$threshold ||= 40;
lib/Image/Magick/Stencilize.pm view on Meta::CPAN
=pod
=head1 NAME
Image::Magick::Stencilize
=head1 SYNOPSIS
use Image::Magick;
use Image::Magick::Stencilize;
my $image = new Image::Magick;
$image->Read('./image.jpg');
$image->Stencilize;
$image->Write('./image_stencilized.jpg');
=head1 DESCRIPTION
Adds method to Image::Magick namespace to make an image you can make a silk-screen out of.
Makes the image black and white.
If you do graphic design or like Andy Warhol, this may be for you.
=head1 Stencilize()
view all matches for this distribution
view release on metacpan or search on metacpan
package Image::Magick::Thumbnail::Fixed;
use 5.6.1;
use strict;
use warnings;
use Carp;
require Image::Magick;
our $VERSION = '0.04';
sub new {
my $class = shift;
}
sub thumbnail {
my ($self, %args) = @_;
my $im = new Image::Magick;
# Required Parameters
my $input = $args{input};
my $output = $args{output};
my $width = $args{width};
if( defined $im ){
$im->Resize( width => $t_width, height => $t_height );
$im->Set( quality => $quality );
$im->Set( density => $density );
my $thumb = new Image::Magick;
$thumb->Set( size => $width . "x" . $height );
$thumb->Set( quality => $quality );
$thumb->Set( density => $density );
__END__
# Below is stub documentation for your module. You'd better edit it!
=head1 NAME
Image::Magick::Thumbnail::Fixed - Perl extension for creating fixed sized thumbnails without distortion.
=head1 SYNOPSIS
use Image::Magick::Thumbnail::Fixed;
my $t = new Image::Magick::Thumbnail::Fixed;
# Required parameters
$t->thumbnail( input => 'input.jpg',
output => 'output.jpg',
width => 96,
Resizing the source image to 96 x 72 will cause distortion. This module will first resize the source in memory
(to 66 x 71) and then compose it ontop of the thumbnail canvas.
=head1 PREREQUISITES
C<Image::Magick>
=cut
=head2 REQUIRED PARAMETERS
Version 0.04 (26 April 2005): Fixed debugging conditional that was too loud - pd <paul@dowling.id.au>, fixed bug with square images - Phillip Munt <phil@savvyshopper.net.au>.
=head1 SEE ALSO
L<Image::Magick>,
L<Image::Magick::Thumbnail>,
L<Image::Thumbnail>
=head1 AUTHOR
Adam Roth, E<lt>aroth@cpan.orgE<gt>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Magick/Thumbnail/NotFound.pm view on Meta::CPAN
package Image::Magick::Thumbnail::NotFound;
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
our $VERSION = sprintf "%d.%03d", q$Revision: 1.8 $ =~ /(\d+)/g;
use Image::Magick::Thumbnail;
use Image::Magick::Square;
use File::Path;
use Carp;
# PUBLIC METHODS
sub new { #{{{
lib/Image/Magick/Thumbnail/NotFound.pm view on Meta::CPAN
# attempt to create thumb and save to disk
sub _create_thumbnail {
my $self= shift;
my $src = new Image::Magick;
$src->Read($self->{in});
my $side= undef;
if ($self->{square}){
($src, $side) = Image::Magick::Square::create($src);
}
my ($x,$y);
# thumb and src are the same thing
($self->{thumb},$x,$y) = Image::Magick::Thumbnail::create( $src, $self->{size})
or $self->_error( $! . ' - Image::Magick::Thumbnail::create failed') and return $self;
$self->{status}->{thumbnail_created} = 1;
return 1;
}
lib/Image/Magick/Thumbnail/NotFound.pm view on Meta::CPAN
1;
__END__
=head1 NAME
Image::Magick::Thumbnail::NotFound - Create thumbnails as http requests for them fail
=head1 SYNOPSIS
# 1) in your .htaccess file, add/modify this line:
ErrorDocument 404 /cgi-bin/error.cgi
# 2) in /cgi-bin/error.cgi:
use Image::Magick::Thumbnail::NotFound;
new Image::Magick::Thumbnail::NotFound; # used as auto, no need to receive object.
# if this is a normal 404 response..
print "Content-type: text/html\n\n";
print "The requested resource returned a 404, File Not Found error.";
lib/Image/Magick/Thumbnail/NotFound.pm view on Meta::CPAN
If a thumbnail is made, this is the maximum pixel height or width that it will be
square
This will make square thumbnails- Undistorted, sides chopped accordingly.
Default is 0, uses C<Image::Magick::Square>.
auto
by default a thumbnail is creted from the source image, given to the request, and
saved to disk. If you want to do something else with the thumbnail object before
lib/Image/Magick/Thumbnail/NotFound.pm view on Meta::CPAN
=head2 error.cgi
In your error.cgi file you must have this:
#!/usr/bin/perl
use Image::Magick::Thumbnail::NotFound;
new Image::Magick::Thumbnail::NotFound; # will exit on success
print "Content-Type: text/html\n\n";
print "That resource is missing.";
exit;
lib/Image/Magick/Thumbnail/NotFound.pm view on Meta::CPAN
And show debug info (status steps).
In your error.cgi:
use strict;
use Image::Magick::Thumbnail::NotFound;
new Image::Magick::Thumbnail::NotFound ({
thumbnails_directory => '/.thumbs',
size => 125,
square => 1,
debug => 1,
});
lib/Image/Magick/Thumbnail/NotFound.pm view on Meta::CPAN
Show debug info to STDERR.
In your error.cgi:
use strict;
use Image::Magick::Thumbnail::NotFound;
my $thumb = new Image::Magick::Thumbnail::NotFound ({
auto => 0,
});
# we have to check that the 404 error was for an image thumbnail
if ($n->get_status('requested')){
# we treat $n->{thumb} just like we do a regular Image::Magick loaded image
$n->{thumb}->Border(geometry=>'1x1', color=>'black');
# save it - optional.. strongly encoluraged though!
$n->save_thumbnail();
lib/Image/Magick/Thumbnail/NotFound.pm view on Meta::CPAN
longer generate a 404 (file not found) error.
By default this module needs little work on your part. It will detect if a request failed for a thumbnail and
if so create it, show it, and save it, so next time there is no 404 error.
But- This script does not hog the Image::Magick object, you can disable I<auto>, and make changes to the
thumbnail as you wish- before you save it to the disk, display, or both.
=cut
lib/Image/Magick/Thumbnail/NotFound.pm view on Meta::CPAN
I had a query string encrypted with L<Crypt::CBC>, it generated an error and this took me to error.cgi, there was a problem
in parsing the query string to match a request (it looks to see if a failed request uri matches jpg, gif, etc in the end.
=head1 SEE ALSO
L<Image::Magick::Thumbnail>
=head1 AUTHOR
Leo Charre, E<lt>leo@leocharre.comE<gt>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Magick/Thumbnail/PDF.pm view on Meta::CPAN
package Image::Magick::Thumbnail::PDF;
use strict;
use Carp;
require Exporter;
use File::Which;
lib/Image/Magick/Thumbnail/PDF.pm view on Meta::CPAN
%EXPORT_TAGS = (
all => \@EXPORT_OK,
);
$Image::Magick::Thumbnail::PDF::DEBUG = 0;
sub DEBUG : lvalue { $Image::Magick::Thumbnail::PDF::DEBUG }
sub create_thumbnail {
# BEGIN GET PARAMS
print STDERR __PACKAGE__."::create_thumbnail() DEBUG ON\ngetting arguments\n" if DEBUG;
lib/Image/Magick/Thumbnail/PDF.pm view on Meta::CPAN
require Image::Magick::Thumbnail;
my $src = new Image::Magick;
my $err = $src->Read($abs_pdf);# warn("92 ++++ $err") if $err;
print STDERR "ok read $abs_pdf\n" if DEBUG;
if (!$all){
lib/Image/Magick/Thumbnail/PDF.pm view on Meta::CPAN
$abs_out=~s/(\.\w{3,5})$/-$pagenum$1/;
}
if ( $arg->{normalize} ){
my $step = $arg->{restriction} * 2;
my ($i,$x,$y) = Image::Magick::Thumbnail::create($image,$step);
$i->Normalize;
$image = $i;
print STDERR ' (normalized) ' if DEBUG;
}
lib/Image/Magick/Thumbnail/PDF.pm view on Meta::CPAN
print STDERR " (quality $$arg{quality}) " if DEBUG;
$image->Set( quality => $arg->{quality} );
}
my($thumb,$x,$y) = Image::Magick::Thumbnail::create($image,$arg->{restriction});
if ($arg->{frame}){
$image->Frame($arg->{frame}.'x'.$arg->{frame});
print STDERR " (framed $$arg{frame}) " if DEBUG;
}
lib/Image/Magick/Thumbnail/PDF.pm view on Meta::CPAN
=pod
=head1 NAME
Image::Magick::Thumbnail::PDF - make thumbnail of a page in a pdf document
=head1 SYNOPSIS
use Image::Magick::Thumbnail::PDF 'create_thumbnail';
my $out = create_thumbnail('/home/myself/mypdfile.pdf');
=head1 DESCRIPTION
lib/Image/Magick/Thumbnail/PDF.pm view on Meta::CPAN
No subroutines are exported by default.
You must import as:
use Image::Magick::Thumbnail::PDF 'create_thumbnail';
my $abs_thumb = create_thumbnail('/abs/path/to.pdf');
Or you can do this also:
Image::Magick::Thumbnail::PDF;
my $abs_thumb = Image::Magick::Thumbnail::PDF::create_thumbnail('/abs/path/to.pdf');
The second example is a lot of text but improves legibility in a lot of code.
By default this will make a normalized thumbnail with a 6 pixel light grey border, 125 pixel max height
and 125 pixel max width png image, which in the above example returns '/abs/path/to-001.pdf'.
lib/Image/Magick/Thumbnail/PDF.pm view on Meta::CPAN
=head1 DEBUG
Note that if you enable debugger
$Image::Magick::Thumbnail::PDF::DEBUG = 1;
You will see that a restriction of 125 changes to 113.. how come? Because we compensate for the frame size.
Asking for a thumbnail no wider or taller then 125 px gives you just that.
=head1 NOTES
lib/Image/Magick/Thumbnail/PDF.pm view on Meta::CPAN
There are three ghostscripts out there, ESP Ghostscript, AFPL Ghostscript, and GNU Ghostscript.
=head1 PREREQUISITES
Image::Magick
Image::Magick::Thumbnail
Smart::Comments
File::Which
Carp
ESP Ghostscript, NOT AFPL Ghostscript, this is tested for.
=head1 SEE ALSO
ImageMagick on the web, convert.
L<Image::Magick::Thumbnail>
=head1 AUTHOR
Leo Charre leocharre at cpan dot org
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Image/Magick/Thumbnail/Simple.pm view on Meta::CPAN
package Image::Magick::Thumbnail::Simple;
use 5.008008;
use strict;
use warnings;
our $VERSION = '0.12';
require Image::Magick;
my $error = q{};
#-------------------------------------------------------------------------------
# Module declaration
lib/Image/Magick/Thumbnail/Simple.pm view on Meta::CPAN
elsif( $size <= 0 ){
$error = 'Invalid width';
return;
}
my $image = new Image::Magick;
$image -> Read( $input );
my( $width, $height ) = $image -> Ping( $input );
# horizonal
lib/Image/Magick/Thumbnail/Simple.pm view on Meta::CPAN
__END__
# Below is stub documentation for your module. You'd better edit it!
=head1 NAME
Image::Magick::Thumbnail::Simple - The thumbnail image is easily made without uselessness.
=head1 SYNOPSIS
=head2 It outputs it to the file.
use Image::Magick::Thumbnail::Simple;
my $t = new Image::Magick::Thumbnail::Simple;
$t -> thumbnail(
input => 'input.jpg',
output => 'output.jpg',
size => 128,
) or die $t -> error;
=head2 It outputs it to the STDOUT.
use Image::Magick::Thumbnail::Simple;
my $t = new Image::Magick::Thumbnail::Simple;
binmode STDOUT;
print "Content-type: image/jpeg\n\n";
$t -> thumbnail(
input => 'input.jpg',
output => 'jpg:-',
lib/Image/Magick/Thumbnail/Simple.pm view on Meta::CPAN
=head2 When specifying it when initializing it
It is succeeded to as long as it doesn't individually specify it at all the
following.
$t = new Image::Magick::Thumbnail::Simple(
size => 128,
blur => 0.8,
quality => 80,
);
lib/Image/Magick/Thumbnail/Simple.pm view on Meta::CPAN
$height = $t -> height;
=head1 DESCRIPTION
The thumbnail image can be easily made by using Image::Magick.
A basic setting is the same as Image::Magick.
Only the processing of the resize of the image is treated.
The version opened to the public is 0.10.
In 0.12, it came to return a size that corrected of the explanation
and was thumbnail.
=head1 SEE ALSO
Image::Magick
=head1 AUTHOR
Satoshi Ishikawa E<lt>cpan@penlabo.netE<gt>
view all matches for this distribution
view release on metacpan or search on metacpan
use lib "../lib";
use Image::Magick::Thumbnail;
my $src = new Image::Magick;
$src->Read('../t/source.jpg');
my ($thumb, $x, $y) = Image::Magick::Thumbnail::create($src,50);
$thumb->Write('source_thumb.jpg');
my ($thumb2, $x2, $y2) = Image::Magick::Thumbnail::create($src,'60x50');
view all matches for this distribution
view release on metacpan or search on metacpan
package Image::Magick;
# Copyright @ 1999 ImageMagick Studio LLC, a non-profit organization
# dedicated to making software imaging solutions freely available.
#
# You may not use this file except in compliance with the License. You may
}
eval "sub $AUTOLOAD { $val }";
goto &$AUTOLOAD;
}
bootstrap Image::Magick $VERSION;
# Preloaded methods go here.
sub new
{
my $this = shift;
my $class = ref($this) || $this || "Image::Magick";
my $self = [ ];
bless $self, $class;
$self->set(@_) if @_;
return $self;
}
sub New
{
my $this = shift;
my $class = ref($this) || $this || "Image::Magick";
my $self = [ ];
bless $self, $class;
$self->set(@_) if @_;
return $self;
}
1;
__END__
=head1 NAME
Image::Magick - objected-oriented Perl interface to ImageMagick. Use it to read, manipulate, or write an image or image sequence from within a Perl script.
=head1 SYNOPSIS
use Image::Magick;
$p = new Image::Magick;
$p->Read("imagefile");
$p->Set(attribute => value, ...)
($a, ...) = $p->Get("attribute", ...)
$p->routine(parameter => value, ...)
$p->Mogrify("Routine", parameter => value, ...)
view all matches for this distribution