After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 559725 - Allow to set image-type and image-num-layers for thumbnail [patch]
Allow to set image-type and image-num-layers for thumbnail [patch]
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: libgimp
git master
Other All
: Normal enhancement
: 2.8
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2008-11-07 10:55 UTC by Takeshi Matsuyama
Modified: 2008-11-10 23:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
First patch to allow to specify image-type and image-num-layers for thumbnail (5.08 KB, patch)
2008-11-07 10:59 UTC, Takeshi Matsuyama
needs-work Details | Review
second patch using GimpImageType enum (5.29 KB, patch)
2008-11-08 13:31 UTC, Takeshi Matsuyama
none Details | Review
cleaned up version of this patch (7.49 KB, patch)
2008-11-09 14:44 UTC, Sven Neumann
needs-work Details | Review
improved patch (8.38 KB, patch)
2008-11-09 17:39 UTC, Sven Neumann
committed Details | Review
another proposal patch (8.38 KB, patch)
2008-11-10 03:54 UTC, Takeshi Matsuyama
none Details | Review

Description Takeshi Matsuyama 2008-11-07 10:55:17 UTC
We cannot set the image type("RGA-alpha", etc...) and the number of layers of the thumbnail shown in "Open Image" dialog for now. With this patch, we can specify these two values in addition to width and height which is available even now.
The alignment sequence of the return array of a thumbnail loader should be the following.

element  the type of value   value
======================================
0        GIMP_PDB_STATUS     status
1        GIMP_PDB_IMAGE      image_ID
2        GIMP_PDB_INT32      width
3        GIMP_PDB_INT32      height
4        GIMP_PDB_STRING     type
5        GIMP_PDB_INT32      num-layers

cf. http://lists.xcf.berkeley.edu/lists/gimp-developer/2008-October/021004.html
Comment 1 Takeshi Matsuyama 2008-11-07 10:59:06 UTC
Created attachment 122176 [details] [review]
First patch to allow to specify image-type and image-num-layers for thumbnail
Comment 2 Sven Neumann 2008-11-07 19:04:15 UTC
For the image type we should rather use the GimpImageType enum. It can be converted to a string in the core then. See gimp_thumbnail_set_info_from_image() in app/core/gimpimagefile.c.
Comment 3 Takeshi Matsuyama 2008-11-08 13:31:50 UTC
Created attachment 122227 [details] [review]
second patch using GimpImageType enum

The alignment sequence of the return array of a thumbnail loader should be the
following.

element  the type of value   value
======================================
0        GIMP_PDB_STATUS     status
1        GIMP_PDB_IMAGE      image_ID
2        GIMP_PDB_INT32      width
3        GIMP_PDB_INT32      height
4        GIMP_PDB_INT32      type
5        GIMP_PDB_INT32      num-layers

"type" showed be GimpImageType.
If width (or height) is 0, the message, "W x H pixels" is not shown under thumbnail.
////////////////

Is there any good place where the explanation of thumb_return_args like mentioned above is written?
Is the type of "type"(=enum) "GIMP_PDB_INT32"? or GIMP_PDB_INT16 is suitable?
Comment 4 Sven Neumann 2008-11-09 14:44:12 UTC
Created attachment 122265 [details] [review]
cleaned up version of this patch

This is a slightly cleaned up version of your patch. It is still not suited for inclusion though as it does not deal with the possibility that a thumb-loader does not specify the image-type and number of layers. The code needs to take this into account and should not set this information on the thumbnail object then.
Comment 5 Sven Neumann 2008-11-09 17:39:22 UTC
Created attachment 122275 [details] [review]
improved patch

This updated patch should work, but I haven't found time yet to test it. We should probably also change some plug-ins to include this information in the thumbnail load procedure.
Comment 6 Takeshi Matsuyama 2008-11-10 03:54:02 UTC
Created attachment 122304 [details] [review]
another proposal patch

Thanks Sven. Very informative patch for me.
I think that the 156'th line of your patch should be
+  *type = -1;

About "num_layers", using 0 is enough not to specify it as long as reading gimp_imagefile_get_desc_string() instead of -1.
Do I overlook something?

I attached another patch to modify about mentioned above.
Comment 7 Sven Neumann 2008-11-10 08:21:25 UTC
0 is perfectly valid for "number of layers", so we need to use -1 here. I have now committed my changes with some further cleanups. It would be nice though to also update some plug-ins to make use of this feature. Keeping this bug report open until at least one plug-in has been changed...

2008-11-10  Sven Neumann  <sven@gimp.org>

	Bug 559725 – Allow to set image-type and image-num-layers for
	thumbnail

	* app/file/file-open.[ch] (file_open_thumbnail): added parameters
	for image-type and number of layers. Try to get these from the
	procedure return values. Changes based on a patch from "tks".

	* app/core/gimpimagefile.c (gimp_imagefile_create_thumbnail)
	(gimp_thumbnail_set_info): set image-type and number of layers if
	specified.
Comment 8 Sven Neumann 2008-11-10 23:15:57 UTC
2008-11-11  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/file-pdf.c: also return image type and number of
	pages. Followup to bug #559725.