I currently have a PHP script that does some fancy image magick stuff for a web gallery. As it stands now i end up having to write like 6 temporary files in the process of getting one output. It actually only takes about 2-3 seconds to run on a 1mb JPG, but i have a feeling that coudl be made much faster and the code much simpler. I store the temp files as uncompressed png's as it seems to be fast and it preserves any alpha channel stuff used in a few of the steps. A sample of what it looks like can be seen at: http://sadclown.net/gallery (images are cached, so hopefully it won't be too slow after they are viewed once)

Here's basically what i'm doing (with most of the php chopped out)

# Resize the original image to 2x the final size, so it is easier to work with. convert -size {$quadx}x{$quady} '$origPath' -thumbnail x{$doubley} -resize '{$doublex}x<' -gravity center -crop {$doublex}x{$doubley}+0+0 +repage -compress None '$cut_to_fit' ;

#This section is some voodoo, i can't remember exactly, to get a niec, smooth looking AA ish font with some depth to it convert -size {$doublex}x60 xc:none -gravity center -stroke black -strokewidth 4 -pointsize 14 -annotate 0 '$title' -channel RGBA -blur 0x3 -stroke none -fill white -pointsize 14 -annotate 0 '$title' '$cut_to_fit' +swap -gravity south -geometry +0+2 -composite -compress None '$label_fancy' ; convert -size {$doublex}x -background none -gravity center -pointsize 14 -fill white caption:'$title' -compress None '$text1' ; ";
convert $text1 -shadow 100x4 -compress None '$outline' ;
composite -compose over -gravity center '$text1' '$outline' -compress None '$text2' ;
convert '$text2' -shadow 70x8 -compress None '$shadow' ;
composite -compose over -gravity center '$text2' '$shadow' -compress None '$text3' ;
composite -compose over -gravity south '$text3' $cut_to_fit '$label_fancy' ;

#Add a white border.
convert '$label_fancy' -bordercolor white -border 6 -bordercolor grey60 -border 1 -background none -rotate $randomnumber -background black \( +clone -shadow 60x4+4+4 \) +swap -background white -flatten -compress None '$poloroid_single' ;

#convert to final image
convert '$poloroid_single' -resize 250x250! -strip -depth 8 -colors 256 -quality 85 '$newPath' ;

If anyone can help me clean this up, it would be greatly appreciated.

Thanks,
Jeff

_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to