View a multipage TIFF in Javascript

余生长醉 提交于 2019-12-23 09:37:42

问题


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.


回答1:


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:

# extract page 15 from tiff file

convert 'image.tif[15]' image-15.jpg  

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.




回答2:


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.




回答3:


There are plugin that provide those function. Alternatiff is a good example.




回答4:


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.




回答5:


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.



来源:https://stackoverflow.com/questions/5262409/view-a-multipage-tiff-in-javascript

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!