public static byte [ ] writeImageToBytes ( BufferedImage image , String formatName , Float quality ) throws IOException { byte [ ] bytes = null ; if ( quality != null ) { bytes = compressAndWriteImageToBytes ( image , formatName , quality ) ; } else { bytes = writeImageToBytes ( image , formatName ) ; } return bytes ; }
Write the image to bytes in the provided format and optional quality