Author Topic: Thumbnail size  (Read 8914 times)

0 Members and 1 Guest are viewing this topic.

Offline Warz

  • Newbie
  • *
  • Posts: 44
    • View Profile
Thumbnail size
« 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)

Offline Warz

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: Thumbnail size
« Reply #1 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

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Thumbnail size
« Reply #2 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($destTHUMB_PATH) ? " -strip" "")." -quality ".$quality." -antialias -geometry $width"."x"."$height \"$src\" \"$dest\"";

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline batu544

  • Sr. Member
  • ****
  • Posts: 336
    • View Profile
    • Free Celebrity wallpapers
Re: Thumbnail size
« Reply #3 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:

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Thumbnail size
« Reply #4 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).
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Warz

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: Thumbnail size
« Reply #5 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?

Offline Warz

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: Thumbnail size
« Reply #6 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?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Thumbnail size
« Reply #7 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\"" "";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Warz

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: Thumbnail size
« Reply #8 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