"Only Shrink Larger Images" also modifies smaller images
"Only Shrink Larger Images" also modifies smaller images
Hi, I'd like to use the option to "Only Shrink Larger Images", but I find that it also modifies the smaller images, I guess it recompresses them without resizeing it. I think it should not alter the files if it is not necessary, is there a way to preserve the smaller images so they are not altered? If not, it would be a good improvement.
Last edited by inigomena on 2008-04-09T06:06:11-07:00, edited 1 time in total.
Re: "Only Shrink Larger Images" also modifies smaller images
http://www.imagemagick.org/script/comma ... php#resize
As you have not posted you code I am guessing you need to read the link above.
As you have not posted you code I am guessing you need to read the link above.
Re: "Only Shrink Larger Images" also modifies smaller images
I am using command line 'convert':
convert one.jpg -resize "640x480>" other.jpg
The source file is 624x396 and 68KB. The new file is 624x396 (OK) but it is 62KB. I don't want it to modify files unless it is necessary to resize them (I want to use it in a batch process for a lot of files, some of them will need to be resized but I don't want to modify the others).
convert one.jpg -resize "640x480>" other.jpg
The source file is 624x396 and 68KB. The new file is 624x396 (OK) but it is 62KB. I don't want it to modify files unless it is necessary to resize them (I want to use it in a batch process for a lot of files, some of them will need to be resized but I don't want to modify the others).
Re: "Only Shrink Larger Images" also modifies smaller images
I would think that is due to jpg compression; I do some tests with different -quality settings to see what happens.
Re: "Only Shrink Larger Images" also modifies smaller images
Yes, I think it loads the picture, checks whether it needs to resize it and then saves it again, recompressing in jpg format; if it has not needed to make changes, it would be better to leave the picture as it is, without saving it again.
Re: "Only Shrink Larger Images" also modifies smaller images
Yes I have just done a test:
original image = 13560
-quality 90 = 6784
-quality 60 = 3955
-quality 30 = 2842
original image = 13560
-quality 90 = 6784
-quality 60 = 3955
-quality 30 = 2842
Code: Select all
<?php
exec ("convert after.jpg -resize \"640x480>\" -quality 30 30.jpg");
exec ("convert after.jpg -resize \"640x480>\" -quality 60 60.jpg");
exec ("convert after.jpg -resize \"640x480>\" -quality 90 90.jpg");
?>
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: "Only Shrink Larger Images" also modifies smaller images
IM uses a default of 80 for jpg quality and will likely do what you are seeing, rewrite the output. I suspect you will need to write a script to test the dimensions of the image and then process it if it is large enough and skip the resize command line if small enough.
You can try posting to the Bugs forum and see what they say.
You can try posting to the Bugs forum and see what they say.