problem with reading out pixbuf



Hi,

I am creating a pixel buffer from an image file with: 
Glib::RefPtr<Gdk::Pixbuf> pixbuf = Gdk::Pixbuf::create_from_file( file_dir
);
But when I want to read out one of the channels I get only zeros? I cannot
find any reason why? I don’t have a Gtk::Image created where I load the
pixbuf in. I want to build a histogram out of the data. That is why I just
need to have it available in the pixbuf. 

To read out the channels I use: 
guint8 *pixels = pixbuf -> get_pixels();		// pointer to data
int channels = pixbuf ->get_n_channels();
int n = pixbuf->get_width() * pixbuf->get_height(); // nr. of pixels
for (int i=0; i<n; i++)
{
	unsigned int pos = (unsinged int) pixels[n*channels];
	...
}

Thank you in advance

-- 
View this message in context: http://www.nabble.com/problem-with-reading-out-pixbuf-tf2500785.html#a6971277
Sent from the Gtkmm mailing list archive at Nabble.com.




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