Page 1 of 1
Optimal JPEG thumbnail dimensions
Posted: 2012-09-08T16:21:04-07:00
by Bilge
Hi,
I only know a little about the JPEG format but I thought that JPEGs are subdivided into "blocks" at a low level. Is it therefore the case that if you want to generate as small a thumbnail image as possible you should select image dimensions that are divisible by this block size? If so what should the dimensions ideally be divisible by?
Re: Optimal JPEG thumbnail dimensions
Posted: 2012-09-09T06:46:44-07:00
by NicolasRobidoux
With the most commonly used parameters, width and height should be multiples of 16 (they can be different without harm) with the default chroma subsampling, 8 if you turn off chroma subsampling.
Re: Optimal JPEG thumbnail dimensions
Posted: 2012-09-09T07:58:48-07:00
by Bilge
Why might someone turn off chroma subsampling?
Re: Optimal JPEG thumbnail dimensions
Posted: 2012-09-09T09:09:54-07:00
by NicolasRobidoux
1) If your image is very small and its dimensions are not multiples of 16, you may not gain much compression given the quality decrease.
2) Subsampling adds artifacts which are sometimes better avoided by not subsampling but instead decreasing the quality setting of the chroma channels:
http://www.wfu.edu/~matthews/misc/jpg_v ... maSub.html.
The full story on optimizing JPEG is complicated business which I don't want to go into. Partly because this is how I make my living.
Re: Optimal JPEG thumbnail dimensions
Posted: 2012-09-09T16:04:18-07:00
by Bilge
Oh, OK. That's cool, I guess. I wasn't trying to take away your livelihood.
Re: Optimal JPEG thumbnail dimensions
Posted: 2012-09-09T17:03:27-07:00
by NicolasRobidoux
@Bilge: No worries. Really.
I just did not want to get back "But if blah blah blah, then isn't it that blah blah blah..." Because what I said is full of caveats, and I did not feel like writing a long manual.
Re: Optimal JPEG thumbnail dimensions
Posted: 2012-09-15T05:26:48-07:00
by Bilge
How do I disable chroma subsampling with ImageMagick?
Re: Optimal JPEG thumbnail dimensions
Posted: 2012-09-15T05:46:02-07:00
by NicolasRobidoux
Re: Optimal JPEG thumbnail dimensions
Posted: 2012-09-15T06:01:47-07:00
by Bilge
NicolasRobidoux wrote:Use 1x1.
I actually tried that but I got the same result as if I hadn't specified the sampling factor option at all so I thought it must be invalid. The only value that I tried which changed the output was 2x1 which resulted in a file size reduction.
Re: Optimal JPEG thumbnail dimensions
Posted: 2012-09-15T06:10:18-07:00
by NicolasRobidoux
I vaguely remember requesting that the default be switched to no chroma subsampling. Apparently it is. I believe that with older IM 2x1 is the default.
2x1 is standard chroma subsampling.
Generally, 2x1 is a very good size reduction/visual quality trade off.
Re: Optimal JPEG thumbnail dimensions
Posted: 2012-09-15T06:55:07-07:00
by NicolasRobidoux
Yes, I'm pretty sure that I made that request, on the basis that users should get something very very good when the JPEG quality setting is set to a high value, and you simply don't get that with 2x1, no matter the quality setting. If you set the quality to 95, it generally makes no sense to use 2x1.