在 Javascript 中查看多页 TIFF
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5262409/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
View a multipage TIFF in Javascript
提问by usr-local-ΕΨΗΕΛΩΝ
I currently have multi-paged TIFFimages and I need to browse them page by page via Javascript.
我目前有多页TIFF图像,我需要通过 Javascript 逐页浏览它们。
I have no clue about that. Can you help me? I found some other questions but none seems related to Javascript.
我对此一无所知。你能帮助我吗?我发现了一些其他问题,但似乎都与 Javascript 无关。
Thank you.
谢谢你。
采纳答案by Pekka
I very much doubt JavaScript can help you here: Most browsers can't deal with TIFF images in the first place, let alone multi-page ones.
我非常怀疑 JavaScript 能否在这里为您提供帮助:大多数浏览器一开始都无法处理 TIFF 图像,更不用说多页图像了。
You will need the help of server-side scripting - like PHP - in combination with a tool like ImageMagick.
您将需要服务器端脚本(如 PHP)以及ImageMagick 等工具的帮助。
I've never tried this myself, but IM's multipage syntax seems to be pretty straightforward:
我自己从未尝试过,但 IM 的多页语法似乎非常简单:
# extract page 15 from tiff file
convert 'image.tif[15]' image-15.jpg
note that if your TIFF is in CMYKformat, you will need to perform an additional colour space conversion to RGB - Internet Explorer can't deal with CMYK images in any format.
请注意,如果您的 TIFF 是CMYK格式,您将需要执行额外的色彩空间转换为 RGB - Internet Explorer 无法处理任何格式的 CMYK 图像。
回答by seikichi
I ported the LibTIFF library to Javascript with Emscripten (https://github.com/seikichi/tiff.js). This page (http://seikichi.github.io/tiff.js/multipage.html) is the demo of multipage tiff file.
我使用 Emscripten ( https://github.com/seikichi/tiff.js)将 LibTIFF 库移植到 Javascript 。这个页面(http://seikichi.github.io/tiff.js/multipage.html)是多页 tiff 文件的演示。
回答by Kakail
There are plugin that provide those function. Alternatiff is a good example.
有提供这些功能的插件。 Alternatiff就是一个很好的例子。
回答by jmetz
Update
更新
The original project no longer seems to be maintained (thanks Victoria!), but both tiff.js by GPHelmley and seikichi's libTiff port mentioned in their answer have active forks; see
原始项目似乎不再维护(感谢维多利亚!),但是 GHelmley 的 tiff.js 和他们的回答中提到的 seikichi 的 libTiff 端口都有活动的分支;看
https://github.com/seikichi/tiff.js/network
https://github.com/seikichi/tiff.js/network
and
和
https://github.com/GPHemsley/tiff-js/network
https://github.com/GPHemsley/tiff-js/network
Original
原来的
A new, native JavaScripttiff approach has appeared since the last round of answers: tiff.js, with comments on multi-page tiff support here(apparently added in to pdf.jsthough I haven't checked it out).
一个新的,原生的JavaScript:TIFF办法自上一轮的答案出现 tiff.js,对多页TIFF支持的意见在这里(中明显增加pdf.js虽然我还没有检查出来)。
I found that for my case it was easy to hack the tiff.js code to allow loading multipage tiffs really easily, and plan to contribute the hack to the tiff.js repo.
我发现就我的情况而言,很容易破解 tiff.js 代码以允许非常轻松地加载多页 tiff,并计划将 hack 贡献给 tiff.js 存储库。
回答by herzmeister
If you're ok with a certain plugin technology (namely Silverlight or Moonlight), you can use the free LibTiff .NETlibrary to process and display most kinds of TIFF files client-side.
如果您对某种插件技术(即 Silverlight 或 Moonlight)感到满意,则可以使用免费的LibTiff .NET库在客户端处理和显示大多数类型的 TIFF 文件。

