I have a specific object with image data. And I want read/write images (in BMP, JPEG and PNG formats) to this object.
Of course, I can read/write image into/from BufferedImage and then copy/paste pixels into/from my object. But, I want to do it more faster without intermediate objects!
How can I perform it over standard Java library or throw other Java library?
P.S.:
I know pngj library that allow read PNG images by lines. Maybe you know same libraries for BMP, JPEG (or for all of them: BMP, JPEG, PNG)?
Why don’t you just have the
BufferedImagein yourObject?BufferedImageisn’t all that bad. Otherwise, you will need to use something likeBufferedImageto convert the image file into pixels, and then read theBufferedImageinto something like anint[]array of pixels, but it still requiresBufferedImagein the middle, and this would slow things down by adding an extra loop to read over and store the pixels.Is there a reason why
BufferedImageisn’t suitable for your purpose?