crop image directly from byte array

拟墨画扇 提交于 2019-11-30 20:16:35

The method decodeByteArray(dataArray, offset, length, options) is not intended to crop an image but to parse an image from a byte buffer that contains more data than the image itself. The typical use of this is to extract images from complex binary data structures that include images among other things.

To my knowledge there is no way to crop an image without creating a new one. To me the best you can do is what you are currently doing.

For JPEG (the ubiquitous picture format on mobile devices), it is possible to decode only some specific rectangle. This requires some discipline in writing C code on top of generic software decoder, especially if you want to do it as fast as possible, and waste not extra RAM.

Support in libjpeg-turbo was been added five years after this question had been asked.

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