code: 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;
  	}
docs: Write the image to bytes in the provided format and optional quality
  
  @param image
  buffered image
  @param formatName
  image format name
  @param quality
  null or quality between 0.0 and 1.0
  @return image bytes
  @throws IOException
  upon failure
  @since 1.1.2