I have an image in a byte[]
variable and my goal is to convert it to JPG format and then create a BufferedImage
variable from it.
Speed is very important here. Just to create a BufferedImage
from the byte[]
on a 500kb image takes 0.5 seconds.
One approach is (but very slow) is:
create a BufferedImage from the image byte[]
use ImageIO.write to convert the image to jpg and write it to disk
read the image from disk and create a BufferedImage from it
Is there any faster way to do this, please?
edit:
The byte array contains the content of a valid PNG, JPG or GIF image i have read the HDD.