Created attachment 3888 size-calculation The JPEG thumbnailer generates huge thumbnails. libjpeg only supports scaling from 1/1, 1/2, 1/4, 1/8 and 1/16. -------- unsigned int scale_num, scale_denom Scale the image by the fraction scale_num/scale_denom. Default is 1/1, or no scaling. Currently, the supported scaling ratios are M/N with all N from 1 to 16, where M is the destination DCT size, which is 8 by default (see block_size parameter above). (The library design allows for arbitrary scaling ratios but this is not likely to be implemented any time soon.) -------- For some images, this is not enough and the thumbnail should be something like 1/72th or even more. The current implementation takes this limitation into account by creating a thumbnail as small as possible as is allowed by libjpeg. However, this can still cause thumbnails of 238x4650 pixels to be created. When this behaviour is changed via the attached patch[0], the following behaviour occurs. The scale is set to 1/72, this causes libjpeg to fallback to the default scale of 1/8. I propose to not use the libjpeg to do the scaling, but only use it for extracting the thumbnail. When there is no thumbnail available, fallback on gdk for the scaling of the original image.
No idea if this affects other thumbnailers too, we this can be fixed in the xdg-cache plugin or in the jpeg thumbnailer by adding something like exo_gdk_pixbuf_scale_down does.
Created attachment 3921 Resize jpeg thumbnails before storing them Would be nice to share this function in libtumbler, because it's used in a number of places, but this should do the trick.
(In reply to comment #2) > Created attachment 3921 > Resize jpeg thumbnails before storing them Looks fine to me. > Would be nice to share this function in libtumbler, because it's used in a > number of places, but this should do the trick. libtumbler and tumbler are supposed to be toolkit-agnostic (otherwise tumbler wouldn't have been adopted on the N9), hence no dependency on gdk-pixbuf. We could add a separate utility library for gdk-pixbuf-based thumbnailer plugins. That way tumbler would only load gdk-pixbuf if such a thumbnailer plugin is installed. I too dislike the code replication related to scaling.
We can also do this in xdg-cache for all plugins..
Pushed the fix, worked nice here. Dups are not that nice, but not problematic too, because the function is straightforward. Pushed in d929d61.