Re: patch for gdk-pixbuf to read and write PNG tEXt chunks
- From: Jens Finke <jens triq net>
- To: Sven Neumann <sven gimp org>
- Cc: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: patch for gdk-pixbuf to read and write PNG tEXt chunks
- Date: Tue, 18 Sep 2001 07:58:55 +0200 (CEST)
On 17 Sep 2001, Sven Neumann wrote:
>
> I sent this mail a while ago, but got no feedback so far. I think
> this is a valuable addition to gdk-pixbuf that will make it much
> easier for GTK+ application to implement the proposed Thumbnail
> Managing Standard. Would you please consider to apply this patch...
I second this. It would be a very useful extension.
> Attached is a patch that extends the Gdk-Pixbuf PNG module to store
> key/value pairs passed as options to gdk_pixbuf_save() into those
> tEXt chunks. The PNG load routines read those fields and attach them
> as object data to the GdkPixbuf. As the slightly modified apps in the
> demos directory show, this seems to work reasonably well. The patch
> is in no way considered final. There are a number of issues:
>
> - longjmp might clobber variables (-> make them volatile ?!)
> - I'm not sure how libpng handles compressed tEXt chunks. Will
> png_get_text() return them uncompressed or do we have to take
> care about this ourselves? Do we want to support compressed
> tEXt chunks at all since the PNG standard discourages its use
> (http://www.w3.org/TR/REC-png#C.tEXt)?
Regarding to my experiments, compressed tEXt chunks don't work really. But
I didn't consider to handle the decoding myself (IMO this it the job of
libpng). Since it's use is discouraged and after my tests I would prefer
to use only uncompressed text.
> - should we prefix the options to be stored as tEXt using for
> example "tEXt::" and include that prefix in the data attached
> to the GdkPixbuf as well?
You propose to prefix the attached data to the GdkPixbuf object and
remove this prefix before adding it as png tEXt? IMO this could be
useful, since it allows further extensions of this system.
[...]
> +
> + if (num_keys > 0) {
> + text_ptr = g_new0 (png_text, num_keys);
> + for (j = 0; j < num_keys; j++) {
> + text_ptr[j].compression = -1;
Can you use the PNG_TEXT_COMPRESSION_NONE constant here? This makes it
more obvious that we use no compression.
> + text_ptr[j].key = keys[j];
> + text_ptr[j].text = values[j];
> + text_ptr[j].text_length = (values[j] ?
> + strlen (values[j]) : 0);
> + }
> + png_set_text (png_ptr, info_ptr, text_ptr, num_keys);
> + }
Regards,
Jens
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]