Re: Fast from 16bit to gtk image buffer



Hi,

Piotr Legiecki wrote:
I'm writting simple program which will operate on 16bit per RGB channel (tiff, scanned images) files. ...
So in summary:
I want to manipulate 16 bit per channel image and display the changes as fast as possible using gtk window (not sure if gdkpixbuf or GdkRGB).

Most TIFF files do not support random access (only tiled tiff, AFAIK), so I would:

- unpack the TIFF file to a large memory buffer, organised as RRGGBBRRGGBBRRGGBB etc.

- write something to process from this to an 8 bit RGBRGBRGB memory buffer, perhaps with subsampling and region of interest too ... include your curve adjust look up tables at this stage

- repaint the screen from the 8 bit memory buffer using gdkRGB

- you will need to look out for things like scrolling ... I'd do the conversion in the expose event of a GtkDrawingArea, then pack that into a scrolled window
- you could use gdkpixbuf, but if you're doing subsampling and ROI stuff yourself, the convenience benefits of gdkpixbuf will be a bit marginal (I think)

I maintain an image processing library and GUI that does (roughly) this, you could take a look at the performance of that:

 http://www.vips.ecs.soton.ac.uk/

the gtk2 version is much less optimised, but the gtk1 one is pretty quick (IMO). Try loading a huge TIFF (Insert=>Image from file), double-click on the thumbnail to open a viewer, click on View=>Show display control bar, then drag the left-hand slider. Press '0' to zoom out to fit the image to the window. I get several frames per second update on a 4GB image.

John



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