View a multipage TIFF in Javascript

2019-06-20 05:47发布

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.

5条回答
家丑人穷心不美
2楼-- · 2019-06-20 05:52

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.

查看更多
Rolldiameter
3楼-- · 2019-06-20 05:57

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.

查看更多
Juvenile、少年°
4楼-- · 2019-06-20 05:58

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.

查看更多
冷血范
5楼-- · 2019-06-20 06:00

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

查看更多
在下西门庆
6楼-- · 2019-06-20 06:05

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.

查看更多
登录 后发表回答