Skip to content

Instantly share code, notes, and snippets.

View castmart's full-sized avatar

Juan Carlos Castañeda Martínez castmart

View GitHub Profile
@jamesthompson
jamesthompson / JavaFXImageConversion.java
Created August 13, 2012 21:03
JavaFX Image from a byte array
import javafx.scene.image.Image;
import javax.imageio.ImageIO;
import java.awt.image.*;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
public Image getJavaFXImage(byte[] rawPixels, int width, int height) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
ImageIO.write((RenderedImage) createBufferedImage(rawPixels, width, height), "png", out);