Created
December 6, 2015 18:26
-
-
Save mdeterman/c32adbb0913eefb0da1e to your computer and use it in GitHub Desktop.
getImage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected CImage getImage(String path) throws Exception { | |
BufferedImage image = ImageIO.read(new File(path)); | |
ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |
ImageIO.write(image, "bmp", baos ); | |
baos.flush(); | |
byte[] imageInByte = baos.toByteArray(); | |
baos.close(); | |
return new CImage(imageInByte,image.getWidth(),image.getHeight()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment