在Android操作系统中将JPEG/PNG图像转换为TIFF图像格式

6

我正在开发一款应用程序,需要使用TIFF格式的图像。但是在安卓系统中,你只能将位图/图像转换为JPEG/PNG格式的图片。

有没有什么好的方法可以在安卓系统中将JPEG/PNG文件转换为TIFF格式?

5个回答

0

我最近在Github上发现了Beyka开发的这个很棒的库(它本地使用libtiff和其他工具),提供了许多处理、打开和写入.tiff文件的实用程序。

以下是将JPEG转换为TIFF的示例:

TiffConverter.ConverterOptions options = new TiffConverter.ConverterOptions();
//Set to true if you want use java exception mechanism
options.throwExceptions = false; 
//Available 128Mb for work
options.availableMemory = 128 * 1024 * 1024; 
//compression scheme for tiff
options.compressionScheme = CompressionScheme.LZW; 
//If true will create one more tiff directory, else file will be overwritten
options.appendTiff = false;
TiffConverter.convertToTiff("in.jpg", "out.tif", options, progressListener);

0

Android SDK不支持Java Image I/O。既然答案已被接受,我想知道是否有第三方端口可用? - Viktor Brešan

0

Android不支持TIFF文件。 您可以获取位图的原始像素数据数组,并使用上一条评论中的任何链接手动将其转换为TIFF。


0

如果你想通过Android NDK向你的项目中添加一些 C++,那么 libtiff 应该可以满足你的需求。


0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接