问题描述
我有一个存储在内存中的tiff图像(在javascript变量中)。在浏览器窗口中显示此图像的javascript或html技术是什么?是否有drawimage类型的函数?
I have a tiff image stored in memory (in a javascript variable). What is the javascript or html technique for displaying this image in the browser window? Is there a "drawimage" type of function?
推荐答案
本机浏览器对tiff文件的支持仍然非常糟糕。
Wikipedia对浏览器有很好的概述。
Native browser-support for tiff files is still pretty bad.
Wikipedia has a nice overview on browsers Image format support.
这就是说;因为.tiff图像仍然基本上是一个光栅图像,人们确实可以将其转换(棘手的部分就像支持不同的压缩算法,如PACKBITS,DEFLATE,LZW等)到另一个(浏览器支持的)栅格格式(因此可以将其作为数据提供:img
-source)。
That being said; since a .tiff image is still essentially a raster-image, one could indeed convert it (the tricky part is stuff like supporting different compression-algorithms like PACKBITS, DEFLATE, LZW, etc) to another (browser-supported) raster-format (so one could feed it as a data:img
-source).
有一个名为的库 :客户端纯Javascript映像库,用于加载,保存和操作二进制文件图片。
There is a library called Tiffus: a client side pure Javascript imaging library to load, save and manipulate binary images.
最初的项目目标是创建一个简单的Javascript chrome扩展,它可以将单/多页TIFF图像转换为BMP / GIF图像(这就是名称所在来自)。
The original project aim was was to create a plain Javascript chrome extension which can convert single/multi page TIFF image/s to BMP/GIF image (this is where the name came from).
但现在它支持:
- Windows BMP(无压缩,RLE)
- OS / 2 BMP
- ICO
- GIF
- JPEG
- PNG
- TIFF
- Windows BMP (no compression, RLE)
- OS/2 BMP
- ICO
- GIF
- JPEG
- PNG
- TIFF
目前支持以下图像功能:
and currently supports the folloing image functions:
- 加载
- 保存
- resize
- flip
- 反转颜色
- load
- save
- resize
- flip
- invert color
基本上它的工作原理如下:
Basically it works like this:
- 使用XMLHttpRequest下载为二进制数据的源图像,带
MimeType('text / plain; charset = X-用户定义'); (未来:HTML5
Canvas ImageData) - 使用Tiffus进行图像处理
- 显示为数据URI方案的设计图像(未来:HTML5 Canvas ImageData)
请注意,根据以上内容;作者希望将来使用HTML5 Canvas ImageData
。
Note that according to the above; the author expects to use HTML5 Canvas ImageData
in the future.
希望这会有所帮助!
这篇关于是否有HTML5方法用于显示已加载到内存中的tiff图像数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!