image-tiff icon indicating copy to clipboard operation
image-tiff copied to clipboard

Implement support for planar data

Open 197g opened this issue 4 weeks ago • 0 comments

Draft because the interface is a bit odd.

  • read_image_bytes is enhanced to read additional planes if the buffer is large enough.
  • PreferredBufferLayout is augmented with fields to describe those additional requirements, with the compatibility that previous fields encode only the first plane. This should be changed in a next major version.
  • All the layout computation is moved into image.rs so we have one source of truth for the layout of sub-byte color components, planes, chunk sizes, and strides. All relevant values are computed in one function and then used.
  • expand_chunk is prepared for custom strides which it previously supported in a parameter but that would not scale to multiple planes; also support did not seem consistent? It was not exercised in the public interface and I would not have trusted that..
  • [ ] TODO: reading multiple chunks belonging to different planes of the same basic chunk. The interface is a bit odd since we may have a basic chunk index but if that is not on the first plane, should we then extract planes from that onwards (however much buffer space is available) or should plane selection be more explicit? Also thinking about subsampling here.. Maybe it should not be provided yet.

197g avatar Nov 27 '25 22:11 197g