Re: jpeg



Dean McCullough <dpmccul comcast net> writes:

> I have an application which tries to output the image to jpeg.  A 
> version of this worked in a previous application, which confuses me.
> 
> The code snippet is:
> 
>    GdkPixbuf *sdata;
>    gboolean aaa;
>    GError *er;
> 
>    sdata = gdk_pixbuf_new_from_data ( &pixbuf[level1*levelsize],
> 				     GDK_COLORSPACE_RGB,
> 				     FALSE,8,
> 				     ix, iz,
> 				     3*ix,NULL,NULL);
> 
>     aaa = gdk_pixbuf_save(sdata,outfil,"jpeg",&er,"quality", "100", NULL);
> 
> This last routine returns:  GdkPixbuf-CRITICAL **: gdk_pixbuf_save: 
> assertion `error == NULL || *error == NULL' failed
> 
> Unfortunately, when I go to 
> http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-file-saving.html#gdk-pixbuf-save
> I see:
> If error is set, FALSE will be returned. Possible errors include those 
> in the GDK_PIXBUF_ERROR domain and those in the G_FILE_ERROR domain.
> Unfortunately, the links to GDK_PIXBUF_ERROR points to GError which is 
> not found,  and G_FILE_ERROR link is not found.

The error must be initialized to NULL before using it:

    GError *er = NULL;

Otherwise the routine thinks that the GError is already set, and
refuses to set it itself. 

Generally when you get "-CRITICAL **" errors, it means that gtk+ has
detected a programming error, as opposed to a runtime error. They
should be treated as if the application had crashed.


Soren


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