Decode part of JPEG file

走远了吗. 提交于 2019-12-30 10:37:28

问题


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?


回答1:


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




回答2:


You can't avoid having to decode the scan lines you want to skip, but you can avoid storing them anywhere. When you get the callback from libjpeg for each row, just wait until the row number matches the section of scanlines you want.



来源:https://stackoverflow.com/questions/12022675/decode-part-of-jpeg-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!