strukturag / libheif

libheif is an HEIF and AVIF file format decoder and encoder.
Other
1.6k stars 292 forks source link

Encode Grid #1180

Closed dukesook closed 5 days ago

dukesook commented 1 month ago

LIBHEIF_API struct heif_error heif_context_encode_grid()

Resolves #1176, resolves #648

farindk commented 5 days ago

Thank you. This is nice to have.

In the future, we should have another way to build the grid image step by step by adding tiles one by one, but this is a nice convenience function that can still come in handy.

dukesook commented 5 days ago

Great, thanks for merging.

I also wanted a mechanism for encoding grids that are internal to the codec (for example, the uncompressed codec). But I wasn't sure what the best way to do this was.

farindk commented 5 days ago

I also wanted a mechanism for encoding grids that are internal to the codec (for example, the uncompressed codec). But I wasn't sure what the best way to do this was.

Interesting question. @bradh: Would it be possible to write uncompressed image tiles one by one? Does that pose any problems when the data is zlib compressed?

bradh commented 5 days ago

It should be possible to write tiles one-by-one. There is a way to say "each of these extents needs to be done separately", and to specify the range. That opens up the possibility to recycle the bits in one tile that is used to fill many grid spots (e.g. when using a map, and there is a lot of blue ocean; or when making black fill tiles for an image that is rotated to be north-up).