Re: simple example of using gdk_pixbuf_new_from_file



Like Ive been always yapping around my tutorial,
see this http://cybernetics.freewebspace.com/gtk/
for  some tip on GdkPixbuf.

Your problem might be to change this line
gtk_init (&argc, &argv); 
as
gtk_init (NULL,NULL);


Cheers
Muthu.

--- Raghavendra <raghaven kumar gmail com> wrote:

 
simple example of gdk_pixbuf
#include<gtk/gtk.h>
#include<gdk-pixbuf/gdk-pixbuf.h>
#include <stdlib.h>
#include<string.h>
#include<stdio.h>

#include<string.h>

int main(int argc, char *argv[])
{
GError *gerror;
GdkPixbuf *originalpb, *pb;
GdkPixbuf *rpb, *ipb;
char filename[20];

gtk_set_locale ();


strcpy(filename, argv[1]);

originalpb = NULL;


originalpb=gdk_pixbuf_new_from_file(inputimg,&gerror);
if(!originalpb) {
printf("error message: %s\n", gerror->message);
exit(1);
}
....

hei =
gdk_pixbuf_get_height(originalpb)/downsampling;
wid = gdk_pixbuf_get_width(originalpb)/downsampling;
gdk_pixbuf_unref(originalpb);

....
return 0;
}

I got these errors after compiling it

pix-samp.c: In function `main':
pix-samp.c:43: error: `inputimg' undeclared (first
use in this function)
pix-samp.c:43: error: (Each undeclared identifier is
reported only once
pix-samp.c:43: error: for each function it appears
in.)
pix-samp.c:48: error: syntax error before '...'
token
pix-samp.c:51: error: `downsampling' undeclared
(first use in this function)

and if i remove the downsampling and change inputimg
to filename
it compiles but gives Segmentation Fault at runtime



                
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html




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