So, let's say I want to transcode PNG to JPEG in Java. An image has extreme resolution, say, for example, 10,000 x 10,000 pixels. Using the "standard" Java Script API Writers and Reader, you need at some point to have a full image decoded in RAM, which takes up a very large amount of RAM (hundreds of MB). I watched other tools do it, and I found that ImageMagick uses disk storage on disk, but it seems too slow for my needs. So I need a real streaming recorder. And with the help of true streaming, I mean reading and processing data using switchers or bunkers, not only transmitting the stream as input, but its full decoding in advance.
Now, firstly, the theory - is it even possible, given the JPEG and PNG algorithms, to do this using streams or say in data bunkers? So there is no need to have a full image encoded in memory (or other storage)? In JPEG compression, the first few steps can be performed in streams, but I believe that Huffman coding should build a whole tree of cost probabilities after quantization, so he needs to analyze the whole image - so the whole image needs to be decoded in advance or somehow on demand by region.
And the golden question is, if the above can be achieved, is there any Java library that can really work that way? And save a lot of RAM?
source
share