Search code examples
cjpeglibjpeg

Can I read a part of jpeg image (rectangle) decompressing it up to DCT parameters?


I need to use some part of a jpeg image (a rectangle in the center) decompressing it up to DCT coeficients. Is this possible with libjpeg , or some other open source tool ?


Solution

  • What you're asking to do is non-standard use case. It is unlikely any open source library will have this feature built-in. It shouldn't take major modifications to get the data you need. How much effort are you willing to provide and how much do you understand the JPEG standard and the library you're using?

    If your requested rectangle is on MCU boundaries, then it should be relatively simple to modify the decode loop to copy out the coefficient data that you're interested in. I am not familiar with the open source JPEG libraries, but within my own JPEG codec, the changes required would be trivial.