Reading quantization tables of jpeg files on Android

流过昼夜 提交于 2020-06-28 06:42:05

问题


A previous answer provides code for reading the quantization tables of jpeg files in Java. However it uses javax.imageio.ImageIO which, according to this answer, isn't available on the Android platform.

How can I read read the quantization tables of jpeg files on Android in Kotlin or the Java subset available on Android?

edit

I have found the korlibs/korim Kotlin library which seems to read the quantization tables. But I'm still a beginner with Kotlin so I haven't yet figured out how I go from a string with the path to the JPEG file to printing out the quantization table.


回答1:


I am, unfortunately, not aware of such an API for Android.

However, parsing the JPEG quantization tables aren't that hard... You could probably have a look at my JPEGSegmentUtil and QuantizationTable (originally by Helmut Dersch) classes and adapt them to Android. The mentioned code is available under BSD license.

You would need to replace the javax.imageio.ImageInputStream with a different type, preferably something that implements java.io.DataInput and has proper seek/skip, replace javax.imageio.IIOException with normal IOException, and perhaps a few more tweaks.



来源:https://stackoverflow.com/questions/62516038/reading-quantization-tables-of-jpeg-files-on-android

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