Menu

Image to byte[]

Anonymous
2017-08-31
2017-08-31
  • Anonymous

    Anonymous - 2017-08-31

    Is there a simple way to convert an Image to a byte[] without saving any file?
    I tried with

    ImageIO.write(ImageUtilities.createBufferedImage(output), "jpg", baos);
    

    but the result was an image with a high red drift.

     
  • Jonathon Hare

    Jonathon Hare - 2017-08-31

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    ImageUtilities.write(output, "jpg", baos)
    byte[] bytes = baos.toByteArray();

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.