AcademySoftwareFoundation / AcademySoftwareFoundation/OpenImageIO

API to read ImageInput into ImageBuf

Open
#4,806 6 comments 1 reaction 0 assignees View on GitHub
core APIs roadmap
Dominant language
C++
Stars
2.4k
Forks
698
Avg merge
3d 4h
Merged PRs (30d)
47

Description

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.

Contributor guide

Open the contributing guide

Research direction

Start by reading the ImageInput and ImageBuf APIs, especially ImageBuf::write() and ImageInput::read_image(), then review the alternatives and discussion referenced from #4225. Done requires an agreed API for moving one or more ImageInput subimages into ImageBuf instances with associated metadata, but the issue does not yet choose a design.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.