Skip to content

API to read ImageInput into ImageBuf #4806

@lgritz

Description

@lgritz

In the comments of #4225, @zavinator suggested:

it would be great if the ImageInput class could integrate more seamlessly with ImageBuf, for instance by returning an ImageBuf instance for each subimage along with its associated metadata.

This is a great idea, and I can think of several possible forms for this to take:

  1. An ImageBuf constructor that takes an open ImageInput* where it reads from the "current" subimage of the input into the IB. (IB already has a write() method that writes to an open ImageOutput that you pass it.)
  2. An ImageInput::read_imagebuf() method a bit like read_image(), but returns (or reads into?) an ImageBuf rather than reading into a memory buffer.
  3. One of the above two, but as a fully standalone utility functions rather than being a method of either ImageBuf or ImageInput.
  4. Some kind of iterator that, given an ImageInput* and ImageBuf*, reads each successive subimage from the ImageInput into the IB. (Choice 1: it's just the iterator and you call next() to advance; choice 2: it's a total black box and the caller doesn't iterate, but rather, what you supply is a lambda that is called for each subimage?)

Or something else I haven't thought of?

Please feel free to continue the discussion in the comments to this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    core APIsAffecting public APIs of core functionality classes, such as ImageInput, ImageOutput, ImageBuf.roadmapThis is a priority item on the roadmap for the next major release.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions