简体   繁体   English

在Android中显示Tiff格式图像

[英]Show Tiff format image in Android

I am using ImageView to showing the .tiff formatted image, but I am getting error of NullPointerException . 我使用ImageView显示.tiff格式的图像,但我收到NullPointerException错误。 I am converting the image file into byte array and then setting it in ImageView . 我正在将图像文件转换为字节数组,然后在ImageView进行设置。 How can I show this tiff file? 我怎么能显示这个tiff文件?

You cannot set the tiff image on a ImageView in android directly. 你不能直接在android中的ImageView上设置tiff图像。 http://code.google.com/p/tiffonandroid/source/browse/ http://code.google.com/p/tiffonandroid/source/browse/
this is a sample tiffviewer. 这是一个样本tiffviewer。 This might help you 这可能对你有帮助

Tiff has images stored as rows of bytes starting at defined offsets. Tiff将图像存储为从定义的偏移开始的字节行。 So you can easily retrieve single rows to build the full image. 因此,您可以轻松检索单行以构建完整图像。 If you open any tif file in hex editor you will see that first 4 bytes mark tiff by code. 如果在十六进制编辑器中打开任何tif文件,您将看到前4个字节按代码标记tiff。 And next 4 bytes give offset for metadata about tif image. 接下来的4个字节为关于tif图像的元数据提供偏移量。 Use random access file to open image tif file, then seek the offset and you land into metadata space.From here you can pick offset of required image rows. 使用随机访问文件打开图像tif文件,然后查找偏移量并进入元数据空间。从这里您可以选择所需图像行的偏移量。 Then go and get it.. 然后去拿它..

If we needed full load of image like jpeg or BMP, then collect and combine all these rows after decompression, if any. 如果我们需要像jpeg或BMP那样完全加载图像,那么在解压缩之后收集并组合所有这些行(如果有的话)。 Then you will get the full image 然后你会得到完整的图像

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM