app, libgimp: core loads thumbnail from metadata if no GimpThumbnailProcedure…

… is set.

The order for thumbnail creation in gimp_imagefile_create_thumbnail() is now:

1. If there is a GimpThumbnailProcedure, it is run first.
2. Otherwise we check if a thumbnail is in the metadata.
3. As last resort, we just load the full image.

Part of the fix was to copy gimp_image_metadata_load_thumbnail() into the core
code. I have been wondering if we could not drop the same function from libgimp
and remove the GimpThumbnailProcedure frome file-jpeg, since it just uses the
metadata thumbnail and it is the only plug-in using this code.
Also it is much faster to run this in core and it's generic function which makes
thumbnail loading from Exif data working for every format supported by Exiv2.

On the other hand, the file-jpeg thumbnail procedure also gathers a few more
useful information, such as the color model (in a reliably manner, since based
on JPEG header, unlike from metadata which may be wrong).
This commit is contained in:
Jehan 2023-08-11 22:55:50 +02:00
parent 742bdb4ebe
commit 77a30bfd28
6 changed files with 176 additions and 16 deletions

View file

@ -887,6 +887,11 @@ gimp_image_metadata_save_filter (GimpImage *image,
thumbw = EXIF_THUMBNAIL_SIZE * image_width / image_height;
}
/* TODO: currently our exported thumbnails are always RGB because
* GdkPixbuf only supports RGB so far. While RGB thumbnail may make sense,
* even for CMYK images or other color spaces, grayscale images would be
* better served with a grayscale thumbnail too.
*/
thumb_pixbuf = gimp_image_get_thumbnail (image, thumbw, thumbh,
GIMP_PIXBUF_KEEP_ALPHA);