denemo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Denemo-devel] Thumbnails


From: Till Hartmann
Subject: Re: [Denemo-devel] Thumbnails
Date: Thu, 26 May 2011 23:01:38 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110503 Lightning/1.0b2 Thunderbird/3.1.10

Am 26.05.2011 21:48, schrieb Richard Shann:
> On Mon, 2011-05-23 at 20:08 +0200, Till Hartmann wrote:
>>
>> mypaint uses pygtk, there's a convience method in gtk.gdk.pixbuf for 
>> additional metadata when saving pixbufs. I have no clue how it would 
>> look like in c GTK. 
> The code I am using looks like this (the mtime attribute is commented
> out)
> 
> gchar *uri = g_strdup_printf("Thumb::URI\0file:///%s", thumbname);
>             static gchar *thumbnailsdir = NULL;
>             if(!thumbnailsdir) {
>               thumbnailsdir = g_build_filename (g_get_home_dir(),
> ".thumbnails", "large", NULL);
>               g_mkdir_with_parents(thumbnailsdir, 0700);
>             }
> 
>             gchar * thumbpath = g_build_filename(thumbnailsdir,
> thumbname, NULL);
>         //gchar *mt = g_strdup_printf("Thumb::MTime\0%d", mtime);
>             if(!gdk_pixbuf_save (pb, thumbpath, "png"/*type*/, &err,
> "tEXt", uri/*, "tEXt", mt */, NULL))
> 
> this last line is the one saving attributes, type "tEXt" with value the
> Thumb::URI and uri of the file separated by a NULL.
> This gives an error message from gdkpixbuf 
> 
>  GdkPixbuf-WARNING **: Unrecognized parameter (tEXt) passed to PNG
> saver.
> 
> which seems strange, not to say wrong.
> Any ideas?
> Richard
> 
> 
I doubt that this will be of any help to you, but this is how it's done
with pygtk:
pixbuf.save(tb_filename, 'png', {"tEXt::Thumb::MTime" : file_mtime,
"tEXt::Thumb::URI" : uri})

(where {"key" : value} is a dictionary/map)
I think what you have to do is to append "::Thumb::URI" to "tEXt" and
remove that piece from your current uri string:
gdk_pixbuf_save (pb, thumbpath, "png"/*type*/, &err, "tEXt::Thumb::URI",
uri [...])



reply via email to

[Prev in Thread] Current Thread [Next in Thread]