Skip to content

Support saving of RGBA images with mi.util.write_bitmap #767

Discussion options

You must be logged in to vote

Hi @maxfrei750

The mi.util.write_bitmap function only expects RGB input. It's meant as a convenient and succinct one-liner for the most common case.
In fact, it usually only amounts to:

mi.Bitmap(data).convert(
    pixel_format=mi.Bitmap.PixelFormat.RGB,
    component_format=mi.Struct.Type.UInt8,
    srgb_gamma=True
).write('filename.jpg', quality=-1)

The full interface is obviously more verbose and flexible. I still think this is a reasonable interface for end-users when mi.util.write_bitmap doesn't cover their needs. I don't see the need to further extend this helper function. For an additional alpha channel, only the PixelFormat needs to be changed.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@maxfrei750
Comment options

Answer selected by maxfrei750
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants