Page 1 of 1

-crop command quality loss

Posted: 2013-09-26T03:27:43-07:00
by Pinch
Hey,
My use of the -crop command requires an image's quality to be maintained, but -crop seems to lose quality.

For example, "convert input_file -crop input_widthxinput_height+0+0 output_file" (where input_width and input_height are the input_file's width and height)
which effectively does nothing, reduces the quality for all file formats (jpg 1.51MB -> 1.26MB, png even worse).
Is there any way to avoid this compression? Or is it not an issue in later versions? (regardless, I'm unable to update the version on the server, so a workaround is preferable).

Version 6.6.4-0 Q16 Windows 7 64-bit

Thanks for you help.

Re: -crop command quality loss

Posted: 2013-09-26T05:43:25-07:00
by holden
jpeg is lossy- open>do an operation>save will degrade them. Not a good working format. I'm not sure what IM's default compression is, but you can make it highest quality with -quality 100% http://www.imagemagick.org/Usage/formats/#jpg

I'm curious if the png is actually degraded or if IM just saves it smaller by default. PNG is not lossy (or at least not nearly as much).

Re: -crop command quality loss

Posted: 2013-09-26T06:01:02-07:00
by Pinch
That clears a lot up - link is pretty helpful, cheers. Looks like jpegtran would do the job - I've used it before, but I'm not sure if using it would be possible on my shared hosting.
Do you know if PHP's GD cropping methods are lossless or lossy?

Re: -crop command quality loss

Posted: 2013-09-26T06:15:28-07:00
by holden
Pinch wrote:Do you know if PHP's GD cropping methods are lossless or lossy?
Not sure, but in most programs jpeg handling is lossy atm. I've never used that particular method personally.

Re: -crop command quality loss

Posted: 2013-09-26T06:55:26-07:00
by snibgo
Png shouldn't be lossy at all. If the image changes, it's probably a bug, so please post an example. The file size may change, depending on the compression method. But this shouldn't change the image at all.

Re: -crop command quality loss

Posted: 2013-09-26T07:24:49-07:00
by glennrp
Maybe you are losing metadata not quaility. Try "identify -verbose" on the input and output files
to see if that tells you anythng.