4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: Warz on November 26, 2008, 04:23:07 PM

Title: Thumbnail size
Post by: Warz on November 26, 2008, 04:23:07 PM
Hello,

I am using autothumb with ImageMagick, but I have one problem, a thumbnail (153x103 px) takes 40 kb!
It doesn't help to change quality, just a little... I have searched a bit and found out it's possible to have smaller size (5kb, like i get with programs on my computer), you can see i find a code here:
http://www.perlmonks.org/?node_id=495333

but I don't know how to insert the code. Maybe someone can give advice?

Thanks a lot :)

PS: I have already done this: http://www.4homepages.de/forum/index.php?topic=3509.msg14482#msg14482 (to make image look better)
Title: Re: Thumbnail size
Post by: Warz on November 26, 2008, 09:28:50 PM
haha nevermind me, google is my friend:
http://www.imagemagick.org/discourse-server/viewtopic.php?f=5&t=10121

What I did was only to add -strip

From:
Code: [Select]
  $command = $convert_options['convert_path']." -quality ".$quality." -antialias -geometry $width"."x"."$height \"$src\" \"$dest\"";to:
Code: [Select]
  $command = $convert_options['convert_path']." -strip -quality ".$quality." -antialias -geometry $width"."x"."$height \"$src\" \"$dest\"";
Now this is exciting, from 40kb to 7kb  :D
Title: Re: Thumbnail size
Post by: V@no on November 27, 2008, 01:13:17 AM
Thank you for sharing this.
By default ImageMagick preserves EXIF/IPTC info (apparently)

Your solution will remove EXIF/IPTC on thumbnails and resized images, this solution might not be desired if EXIF is important ;)

To remove EXIF/IPTC only from thumbnails use this instead:
  $command = $convert_options['convert_path'].(strstr($dest, THUMB_PATH) ? " -strip" : "")." -quality ".$quality." -antialias -geometry $width"."x"."$height \"$src\" \"$dest\"";

Title: Re: Thumbnail size
Post by: batu544 on November 27, 2008, 03:03:16 AM
HI,
    I have not noticed this file size.. :) I am using GD Bibliothek for thumbnail creation .. Is this creates the thumbnails in less size ??  :roll:
Title: Re: Thumbnail size
Post by: V@no on November 27, 2008, 03:04:55 AM
GD doesn't save any EXIF/IPTC, that's why you didn't notice it ;)
And yes, GD creates images with smaller filesize, but quality is a little worse then with IM (not as sharp).
Title: Re: Thumbnail size
Post by: Warz on November 28, 2008, 02:38:42 PM
Thanks, I tried that other command line and it worked very well too :)

But I have another problem, how can I make thumbnail fixed size, so called "stretch to fit"? It doesn't matter what the original picture looks like, I want to always have a picture with width: 154 and height: 104. Is this possible?
Title: Re: Thumbnail size
Post by: Warz on December 03, 2008, 11:35:13 PM
Thanks, I tried that other command line and it worked very well too :)

But I have another problem, how can I make thumbnail fixed size, so called "stretch to fit"? It doesn't matter what the original picture looks like, I want to always have a picture with width: 154 and height: 104. Is this possible?
Anyone?
Title: Re: Thumbnail size
Post by: V@no on December 04, 2008, 01:14:03 AM
In includes/functions.php find two times:
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";

Insert below:
      $width_height = (!empty($image_info[3])) ? " width=\"154\" height=\"104\"" : "";
Title: Re: Thumbnail size
Post by: Warz on December 04, 2008, 12:02:10 PM
In includes/functions.php find two times:
      $width_height = (!empty($image_info[3])) ? " ".$image_info[3] : "";

Insert below:
      $width_height = (!empty($image_info[3])) ? " width=\"154\" height=\"104\"" : "";

Hey,

are you sure? It didn't work for me?

I tried to:
- Add the line once under the last one
- Add the line under both
- Add the line twice and remove the other lines