Search code examples
jpegpartiallibjpeg

Decode part of JPEG file


I'm trying to load part of big JPEG file (hundreds of megapixels) with a limited memory footprint. I need only about a 1000 scanlines of 20000. It seems that current implementation of libjpeg (as well as its fork libjpeg-turbo) doesn't provide a way to skip unneeded 19k scanlines without decoding them. Is there a workaround for it without digging into libjpeg internals?


Solution

  • Partial JPEG decoding was implemented in jpeglib-turbo one year ago. I didn't try it, but I guess it should work.

    Check it:

    Add further partial decoding optimization #34