How to get raw pixel data into JavaFX

Benjamin Gudehus hastebrot at
Wed Apr 29 14:29:39 UTC 2015

Hi Philipp,

as far as I know PixelWriter, WritableImage and ImageView fits better for
handling raster images than Canvas.

TestFX uses PixelWriter.setArgb() to convert screenshots from Glass with
Monocle to PNG files:


On Wed, Apr 29, 2015 at 4:21 PM, Philipp Dörfler <phdoerfler at>

> Hello list,
> I got some very low level pixel data residing in memory with a pixel
> format and want to get that into JavaFX. I am talking about raw bytes, BGR,
> 24 bit per pixel etc..
> The library providing this pixel data is OpenCV and although it allows for
> encoding the data into a standard format like ".bmp" or ".png" which then
> can be read by JavaFX, I would like to avoid this extra conversion process
> because I got some real time constraints.
> As far as I understand this is what the PixelReader and PixelWriter
> interface is for. Is this correct? Where can I find additional information
> on how to use them besides the Javadoc? Would using the Canvas be easier?
> Can I somehow use the GraphicsContext of Canvas to do that?
> I'd be grateful for any pointers even when it's just "check out the class
> XZY in the underlying prism code: <link to bitbucket>".
> Thanks and best regards!
> Philipp Dörfler

More information about the openjfx-dev mailing list