[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Generate thumbnails



On Mon, Mar 06, 2006 at 04:55:41PM -0500, Matthias Julius wrote:
Steve Block <scblock@ev-15.com> writes:

The options are most definitely NOT supposed to come before the input
file. This changed in version 6.x to make the ImageMagick syntax more
consistent.

Consistent with what?  Not many tools are expecting non-option
arguments before options (I can't think of one).  How about changing
cp, mv etc.?  It's a bad decision to change behavior like that.

Internally consistent. If you look at the 6.x documentation they treat the whole thing as a stream operation, i.e. load an image, do this, do that, maybe load a second image and so something with that, composite the two images, load a third, resize it, change some colors, add a border, and then write output. If you look over the documentation it starts making a lot of sense.

This is especially useful when using other interfaces such as the Perl module, PHP module, or C++ API.

For example, from one of my perl scripts:

   my $image = Image::Magick->new;

   # Read the image into the object, print any errors that occur
   my $rc = $image->Read("$file");
   warn "$rc" if "$rc";

   # Create the thumbnail using ImageMagick commands
   # Feel free to set the sequence to anything you like for
   # thumbnail creation
   #
   # For more info, see
   # http://www.imagemagick.org/script/perl-magick.php
   $image->Set(quality=>'85');
   $image->Set(density=>'72x72');
   $image->Set(interlace=>'Line');
   $image->Resize(geometry=>'300');
   $image->UnsharpMask(radius=>1.3, sigma=>1.1, amount=>40, threshold=>0.05);
   $image->Crop(geometry=>'125x125+20+20');
   $image->Set(bordercolor=>'white');
   $image->Border(geometry=>'1x1');
   $image->Write($sqfile);

The command line program convert would follow the same sequence of opration: convert file.jpg -quality 85 -density 72x72 -interlace Line -resize 300 -unsharp 1.3x1.1+40+.05 -crop 125x125+20+20 -bordercolor white -border 1x1 out.jpg

There is a pretty good explaination of why these options changed at http://www.cit.gu.edu.au/~anthony/graphics/imagick6/basics/

--
Steve Block
http://ev-15.com/
http://steveblock.com/
scblock@ev-15.com



Reply to: