在Android上读取jpeg文件的量化表 [英] Reading quantization tables of jpeg files on Android

查看:170
本文介绍了在Android上读取jpeg文件的量化表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先前的答案提供了用于读取Java中jpeg文件的量化表的代码.但是,根据此答案,它使用的javax.imageio.ImageIO在Android平台上不可用.

如何读取Kotlin上Android上jpeg文件的量化表或Android上可用的Java子集?

修改

我找到了 korlibs/korim Kotlin库,它似乎解决方案

不幸的是,我不知道适用于Android的此类API.

但是,解析JPEG量化表并不难...您可能可以看看我的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.

解决方案

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.

这篇关于在Android上读取jpeg文件的量化表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆