Create multiple thumbnails in ImageMagick / GraphicsMagick

I am currently writing shellscript for Bash, which will create thumbnails of various sizes for some rather large volumes of large images.

I was wondering if it is possible to force GM / IM to create several thumb sizes in one pass, so as not to load the same image over and over, to create different thumbnails, thereby saving memory and time when executing the script

+6
imagemagick thumbnails image-scaling graphicsmagick
source share
2 answers

You can do this using ImageMagick Perl bindings or binding to any other language of your choice:

#!/usr/bin/perl use Image::Magick; my($image, $x); $image = Image::Magick->new; $x = $image->Read('sars.png'); warn "$x" if "$x"; $x = $image->Resize(geometry=>'600x600'); warn "$x" if "$x"; $x = $image->Write('x.png'); warn "$x" if "$x"; $x = $image->Resize(geometry=>'400x400'); warn "$x" if "$x"; $x = $image->Write('y.png'); warn "$x" if "$x"; $x = $image->Resize(geometry=>'100x100'); warn "$x" if "$x"; $x = $image->Write('z.png'); warn "$x" if "$x"; 

conjure supports the Magick Scripting Language XML format, but it’s more complicated before my eyes than the Perl version, and the Perl binding documentation is definitely better.

+1
source share

According to this post, you can use -write filename with GraphicsMagick to "write the current image to the specified file name and then continue processing." to create various smaller sizes when reading the original image only once. "

+1
source share

All Articles