0

How To Calculate JPG Data As It Loads From The Input Stream

I need to calculate RGB pixel data from a JPG file on demand. In other words, I cannot load the whole image. I need to open the stream, skip to the information I need, and ultimately return an array of RGB information I need.

I want to extract all the compression information I need, and use it to go after a specific targeted pixel.

The programming language I need to implement this in is JAVA. Is there any classes/APIs that will help me achieve this? Or do I need to create my own JPGInputStream?

JGlass
  • 1,427
  • 2
  • 12
  • 26
user1780932
  • 81
  • 1
  • 7
  • See if this Q&A helps you out [what is the best java image processing library approach](https://stackoverflow.com/questions/603283/what-is-the-best-java-image-processing-library-approach) – JGlass Nov 14 '18 at 19:09

1 Answers1

1

If your JPEG stream contains a sequential frame, you could decode each scan (usually 1, 3, or 4) as they arrive and display them. It would look pretty funky color wise.

If your JPEG stream contains a progressive frame, you could also decode after each scan. In that case the progression would be pretty normal.

This kind of approach was great in the days of dialup internet where it could take minutes to download a single image. These days, there tends to be little value in it.

user3344003
  • 20,574
  • 3
  • 26
  • 62