Skip to content

How to save images? #736

Answered by KelSolaar
aurelienbl asked this question in Q&A
Discussion options

You must be logged in to vote

Allright, took 5 minutes to look at that, it seems like imageio (PIL?) is trying to be smart and whenever it has floating point data casted to 8-bit, it remaps it as follows: [min, max] --> [0, 255] thus you should do something like that:

my_image = (colour.cctf_encoding(np.clip(my_image, 0, 1)) * 255).astype(np.uint8)

Replies: 8 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by KelSolaar
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #557 on January 16, 2021 22:56.