Is there an HTML5 method for displaying tiff image data already loaded into memory

I have a tiff image stored in memory (in a javascript variable). What javascript or html technique to display this image in a browser window? Is there a drawimage function?

+3
source share
1 answer

The native browser support for tiff files is still very poor.
Wikipedia has a good overview in browsers. Image format support .

It is said; since the .tiff image is still a bitmap, it can really be converted (the hard part is something like supporting various compression algorithms such as PACKBITS, DEFLATE, LZW, etc.) in another (supported by the browser) bitmap format (therefore, you can feed it as a data:img source).

There is a library called Tiffus : a client-side Javascript image library for loading, saving, and manipulating binary images.

The initial goal of the project was to create a simple Javascript chrome extension that can convert single / multi-page TIFF images to BMP / GIF images (where the name comes from).

However, it now supports:

  • BMP for Windows (no compression, RLE)
  • OS / 2 BMP
  • ICO
  • GIF
  • Jpeg
  • PNG
  • Tiff

and currently supports the following image features:

  • load
  • save
  • resize
  • flip
  • invert color

It basically works as follows:

  • The original image is loaded as binary data using XMLHttpRequest using MimeType ('text / plain; charset = x-user-defined'); (future: HTML5 Canvas ImageData)
  • Image Processing Using Tiffus
  • Projection image shown as a data URI scheme (future: HTML5 Canvas ImageData)

Please note that according to the above; author expects to use HTML5 Canvas ImageData in the future.

Hope this helps!

+3
source

Source: https://habr.com/ru/post/1494572/


All Articles