Web Hosting Talk







View Full Version : Imagemagick (how to reduce thumbnail size)


2005
12-03-2006, 08:33 AM
Hello,

I use Imagemagick to create thumbnails from jpg images. The problem is that I don't know how to reduce thumbnail size.

For example, one of thumbnails (67x90 px) is 1 KB, but another thumbnail (90x68 px) - 53 KB !!!

Is there any way how to keep all thumbnails under 3-5 KB?

I use this command:


exec("convert -geometry \"".$newwidth."x".$newheight."\" \"$sourcefile\" \"$destinationfile\"");

Thank you in advance.

anlene
12-03-2006, 08:42 AM
Hi, this is just straight from my head. You can consider using PHP function filesize() to check the thumbnail size and use imagemagick downsampling to reduce the number of pixels in the image. Of course, the quality of the image won't be as sharp. I guess for your case, you don't mind at all. :)

foobic
12-03-2006, 09:32 AM
Try "convert -strip -geometry etc. etc."

2005
12-03-2006, 09:57 AM
Thank you very much for your replies. It looks that "-strip" did the trick.
I just uploaded an image and it's thumbnail size with "strip" is 1.28 KB. Without "strip" it was 58 kb.