How to properly save out color corrected .png
files?
#70
-
I am following along the color correction Jupyter Notebook but am not completely sure how to save out the image. The previewed correction of the image looks great, but the saved Current Code# continued ...
corrected_image = colour.colour_correction(
image,
swatches,
REFERENCE_SWATCHES)
# this plot looks great!
colour.plotting.plot_image(colour.cctf_encoding(
corrected_image))
# some step is missing here ???
# this output looks bad.
colour.io.write_image(image=corrected_image,
path=new_path) # new_path ends in `.png` As it is this code also produces the following warning message
Please, any guidance to do this step the proper way would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi Corbain, You would need to do something along those lines:
Note though that you might clip some values doing so and it might be preferred, depending on your application to save as an linear EXR instead of PNG file. Cheers, Thomas |
Beta Was this translation helpful? Give feedback.
-
After inspecting the implementation of I did the following: # continued ...
bit_depth = 'uint8'
output_image = corrected_image
output_image = colour.cctf_encoding(output_image)
output_image = np.clip(output_image, a_min=0, a_max=1)
output_image = colour.io.convert_bit_depth(output_image, bit_depth)
colour.io.write_image(image=output_image,
path=new_path,
bit_depth=bit_depth) Looks like Thomas and I replied at the same time, thanks so much for your help! Both implementations accomplish the same thing of: cctf encoding, clipping the np.ndarray values, and putting on the 8-bit scale. I will also look into the alternate file formats as well. Thanks again. |
Beta Was this translation helpful? Give feedback.
Hi Corbain,
You would need to do something along those lines:
Note though that you might clip some values doing so and it might be preferred, depending on your application to save as an linear EXR instead of PNG file.
Cheers,
Thomas