libheif icon indicating copy to clipboard operation
libheif copied to clipboard

heif_image_add_channel(): Possible bug?

Open jerstlouis opened this issue 1 year ago • 2 comments

https://github.com/strukturag/libheif/blob/master/libheif/api/libheif/heif.cc#L1824

The ! check does not seem to be equivalent to:

if (image->image->add_channel(channel, width, height, datatype, bit_depth, nullptr) != Error::Ok) {

Changing it to the latter seemed to avoid the Cannot allocate memory for image plane message.

cc. @farindk

jerstlouis avatar Dec 16 '24 21:12 jerstlouis

Right, thanks. That line was overlooked when I changed the return type from bool to Error. I have corrected it in the patch above.

Note that there is currently not much use for heif_image_add_channel() because the other data-types can only be saved by the 'uncompressed' codec and that part is not implemented yet. Everybody currently uses heif_image_add_plane() instead.

farindk avatar Dec 16 '24 22:12 farindk

@farindk @pcdion is filing a separate issue about this because we are trying to output non-visual gridded coverage of real values in uncompressed HEIF from our OGC API - Coverages / Tiles API (e.g. elevation model, but could be multiple fields like relative humidity, temperature...).

jerstlouis avatar Dec 16 '24 22:12 jerstlouis