在 Javascript 中查看多页 TIFF
我目前有多页 TIFF
图像,我需要通过 Javascript 逐页浏览它们。
我对此一无所知。你能帮助我吗?我发现了一些其他问题,但似乎没有一个与 Javascript 有关。
谢谢。
I currently have multi-paged TIFF
images and I need to browse them page by page via Javascript.
I have no clue about that. Can you help me? I found some other questions but none seems related to Javascript.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
我使用 Emscripten (https://github.com/seikichi/tiff.js) 将 LibTIFF 库移植到 Javascript。
此页面(http://seikichi.github.io/tiff.js/multipage.html)是多页 tiff 文件的演示。
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.
有提供这些功能的插件。 Alternatiff 就是一个很好的例子。
There are plugin that provide those function. Alternatiff is a good example.
更新
原始项目似乎不再维护(感谢维多利亚!),但是 GPHelmley 的 tiff.js 和在其答案中提到的 seikichi 的 libTiff 端口都有活跃的分叉;请参阅
https://github.com/seikichi/tiff.js/network
和
https://github.com/GPHemsley/tiff-js/network
原创
自上一轮答案以来,出现了一种新的原生 JavaScript tiff 方法
tiff.js,包含对多页 tiff 支持的评论此处(显然已添加到 pdf.js 虽然我还没有检查过)。
我发现就我的情况而言,很容易破解 tiff.js 代码以允许轻松加载多页 tiff,并计划将破解贡献给 tiff.js 存储库。
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
https://github.com/seikichi/tiff.js/network
and
https://github.com/GPHemsley/tiff-js/network
Original
A new, native JavaScript tiff approach has appeared since the last round of answers:
tiff.js, with comments on multi-page tiff support here (apparently added in to pdf.js though I haven't checked it out).
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.
我非常怀疑 JavaScript 能否在这里为您提供帮助:大多数浏览器一开始就无法处理 TIFF 图像,更不用说多页图像了。
您将需要服务器端脚本(例如 PHP)的帮助,并结合 ImageMagick 等工具。
我自己从未尝试过,但 IM 的多页语法似乎非常简单:
请注意,如果您的 TIFF 位于 CMYK 格式,您将需要执行额外的颜色空间转换为 RGB - Internet Explorer 无法处理任何格式的 CMYK 图像。
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.
You will need the help of server-side scripting - like PHP - in combination with a tool like ImageMagick.
I've never tried this myself, but IM's multipage syntax seems to be pretty straightforward:
note that if your TIFF is in CMYK format, you will need to perform an additional colour space conversion to RGB - Internet Explorer can't deal with CMYK images in any format.
如果您熟悉某种插件技术(即 Silverlight 或 Moonlight),则可以使用免费的 LibTiff .NET 用于在客户端处理和显示大多数类型的 TIFF 文件的库。
If you're ok with a certain plugin technology (namely Silverlight or Moonlight), you can use the free LibTiff .NET library to process and display most kinds of TIFF files client-side.