Re: Gdk::Pixbuf::create_from_data problem



Problem solved by copying each pixel value 3 time as if it was an RGB image instead of a grayscale one.
Not very convenient but it work ...

Thanks,
Aurélien

Le 24 avr. 06 à 23:13, Aurélien KAMEL a écrit :

It don't work when multiplying my rowstride by 3, it segfault, probably because the source array is width*height and not width*height*3.

How must be organized the data in the array that I gave as argument to create_from_data ?

Any other solution ?

Aurélien

Le 24 avr. 06 à 22:43, Bob Caryl a écrit :

Aurélien KAMEL wrote:
Hi everyone,

I'm trying to create a Pixbuf from an array of pixels. The array size is width*height, with only one channel because it's a grayscale image.
I call create_from_data like this :

Gdk::Pixbuf::create_from_data(mp.getImg(i,j)->getSrc(), // guint8* array (1024*768)
                    Gdk::COLORSPACE_RGB,false,8,
                    mp.getImg(i,j)->getSizeX(), // 1024
                    mp.getImg(i,j)->getSizeY(), // 768
                    mp.getImg(i,j)->getSizeX()); // 1024

But when I save it to a file or display it I see my image repeated horizontally three times.

I guess it's a problem of channel number ?

How can I solve it ?

Thanks for your help,
Aurélien

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Multiply your rowstride by 3...  it should work then.

Bob
<bob.vcf>

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list




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