image-rs / image

Encoding and decoding images in Rust
Apache License 2.0
4.9k stars 605 forks source link

Support for zif file format? #1578

Open mpizenberg opened 2 years ago

mpizenberg commented 2 years ago

Hi, I'm interested in the zif file format in order to create and visualize very large (800Kx5K pixels) zoomable images. The format seems to be based on a tiled big tiff spec, with tiles composed of jpeg or png images. I'm wondering, how much work do you think would be involved to implement encoders and decoders for the format based on the current state of support of tiff, jpg and png and the format spec listed on the linked page?

fintelia commented 2 years ago

If I understand that page correctly zif is just a constrained version of BigTIFF:

All forms of ZIF can be read and written with libTIFF v.4.0 and later, and other libraries supporting BigTIFF.

The tiff crate that this crate relies on does have some support for BigTIFF. However, I think the API doesn't currently let you seek to read only specific tiles of an image.

mpizenberg commented 2 years ago

@fintelia I'd be mostly interested by the encoding part in fact, since the decoding and viewing part would be handled elsewhere, like with a web viewer.

If that comment from @HeroicKatora is still valid though, it seems the tiff crate does not handle tiling.

That's a tiled tiff. We only support strip based files at the moment.

HeroicKatora commented 2 years ago

That comment is no longer accurate since 0.7.0, although tiled tiffs need to be supported manually:

Decoder::read_tile.

Manually meaning that there is no support for selectively retrieving tiles with tile offsets and configuration, other than doing everything yourself—neverthelss it is feasible do everything through raw tag access.

mpizenberg commented 2 years ago

Thanks @HeroicKatora . I don't see tile primitives for encoding. Would the same be true for encoding? meaning all could be done manually through raw tags?

Anyway, it was a bit intimidating for me for now, so I went for a zoomable format composed of multiple image files (original zoomify format) that I can write directly on disk separately instead of in a zif container.

Feel free to close this issue if you don't want to have "support for ..." issues open until eventually (or never) someone goes back to it.