JPEG thumbnails

Rolf Magnus ramagnus at
Mon Jun 10 17:39:06 BST 2002

On Monday 10 June 2002 17:14, Simon MacMullen wrote:

> Someone has ported kio_thumbnail to use the KFileMetaInfo thumbnail from
> the JPEG when possible.

That was me ;)

> I'm sure this is more elegant from a theoretical
> point of view, but it has the following problems (for me at least):
> (1) When a thumbnail larger than the one in the JPEG is required (on a file
> dialog or the oh-so-popular tooltip), you don't get it.
> I'm sure this is fixable though, just fall back to the ImageCreator when
> you need a large one.

I also noticed that, and of course, I'll have to fix it. But I thought that 
maybe we could scale the thumbnail up a bit if it's too small (up to some 
maximum scale factor when a scaled thumbnail wil just look too ugly). You 
know, it's a huge speed-up for digital camera images, because they tend to be 
very big and rescaling them for thumbnails takes a lot of time.
OTOH, we have the problem that we don't know in advance how big the thumbnail 
will be, so if the image contains a thumbnail, it will definitely be 
extracted, and afterwards, we will know if it's too small. And extracting 
them also means decoding them (the thumbnails temselves are jpeg compressed, 

> (2) When the thumbnail in the JPEG is wrong, you get the wrong result.
> This could be a real problem. I certainly have lots of photos I've rotated
> using mogrify from ImageMagick (I think it's those, it might be the ones I
> rotated with Pixie Plus) and the thumbnail was never rotated, just saved
> back. I'm sure there are lots of other people out there in the same
> position. I know you could say: "your JPEGs are broken, fix them", but I
> have no idea how and I'm sure the normal users don't either.

Hmm, didn't think about that. Actually, you might want to file a bug report to 
the ImageMagick people that they rotate the image but keep the thumbnail 
without rotating it. This is clearly a bug in the image manipulation program. 
It should either recreate the thumbnail or, if it can't do this, at least 
remove it if it's not valid any more.

> How big a performance gain is there from using the JPEG thumbnail? I don't
> have a slow computer with KDE any more so I can't tell, but I know I would
> rather have correct thumbnails than fast ones.

I'm using an Athlon XP at 1.533GHz, and the performance gain is quite big, 
even though my camera images are only 1360x1020, while most cams have much 
bigger dimensions nowadays. And currently, if those thumbnails are used, they 
are also saved back to the disk as png thumbnails, which needs some extra 
time. Using the in-file thumbnails is so fast that we don't need to save them 
back and just always get them dynamically. This even speeds it up more and 
reduces disk space usage.

More information about the kde-core-devel mailing list