Hello,

I have been looking at a tutorial for image processing (implemented in C and 
GTK : http://gtkbook.sourceforge.net/improc/node6.html) and have some jgtk code 
which works fine for getting some information from an image :

//FUNCTIONS

gdk_pixbuf_new_from_file =: ((>libgtk), ' gdk_pixbuf_new_from_file > x *c x')&cd
gdk_pixbuf_get_height =: ((>libgtk), ' gdk_pixbuf_get_height > x x')&cd
gdk_pixbuf_get_width =: ((>libgtk), ' gdk_pixbuf_get_width > x x')&cd
gdk_pixbuf_get_bits_per_sample =: ((>libgtk), ' gdk_pixbuf_get_bits_per_sample 
> x x')&cd
gdk_pixbuf_get_rowstride =: ((>libgtk), ' gdk_pixbuf_get_rowstride > x x')&cd
gdk_pixbuf_get_n_channels =: ((>libgtk), ' gdk_pixbuf_get_n_channels > x x')&cd
gdk_pixbuf_get_pixels =: ((>libgtk), ' gdk_pixbuf_get_pixels > x x')&cd


//CODE

mypixbuf =: gdk_pixbuf_new_from_file 
'/home/emir/j701/addons/demos/gtk/felidae/data/lion.jpg';0

imgheight =: gdk_pixbuf_get_height mypixbuf
smoutput 'Image Height:'
smoutput imgheight 

imgwidth =: gdk_pixbuf_get_width mypixbuf
smoutput 'Image Width:'
smoutput imgwidth

bps =: gdk_pixbuf_get_bits_per_sample mypixbuf
smoutput 'Bits Per Sample:'
smoutput bps

rowstride =: gdk_pixbuf_get_rowstride mypixbuf
smoutput 'Rowstride:'
smoutput rowstride

n_channels =: gdk_pixbuf_get_n_channels mypixbuf
smoutput 'n_channels:'
smoutput n_channels

pixelspointer =: gdk_pixbuf_get_pixels mypixbuf
smoutput 'Pixels pointer:'
smoutput pixelspointer


And it produces the following

//OUTPUT :


Image Height:
188
Image Width:
250
Bits Per Sample:
8
Rowstride:
752
n_channels:
3
Pixels pointer:
176889768

But I don't know how to read the pixelspointer in J (which is returned by 
gdk_pixbuf_get_pixels), I tried some things with memr but didnt get anything 
that looks meaningful. Does someone know how this could be converted to an 
array of integers ?

Thanks,
Emir
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to