在Android上读取jpeg文件的量化表

在Android上读取jpeg文件的量化表

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

问题描述

限时删除!!

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

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

修改

我找到了 korlibs/korim Kotlin库,它似乎阅读量化表格.但是我仍然是Kotlin的初学者,所以我还没有弄清楚如何从带有JPEG文件路径的字符串到打印量化表.

解决方案

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

但是,解析JPEG量化表并不难...您可能可以看看我的 JPEGSegmentUtil QuantizationTable (最初由Helmut Dersch撰写) )类,并将其调整为适用于Android.提到的代码可在BSD许可下获得.

您需要将javax.imageio.ImageInputStream替换为其他类型,最好是实现java.io.DataInput且具有适当查找/跳过功能的东西,将javax.imageio.IIOException替换为普通的IOException,也许还要进行一些调整. >

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文件的量化表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 15:06