You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When i save the image to a jpg file, i get the expected result. When i save the image to a png file, it looks very wrong.
I am using Julia v1.11.3 and Images v0.26.2.
Minimal Working Example:
using Images, ColorTypes
# Fill a matrix with 4 random colors:
image =zeros(RGB24, 100,100)
image[1:50,1:50] .=RGB24(1, 1, 1)
image[50:100,50:100] .=RGB24(1, 0.7, 0.5)
image[1:50,50:100] .=RGB24(0.32, 0.9, 0.01)
image[50:100,1:50] .=RGB24(0.85, 0.52, 0.1)
# Save to jpg and png:save("image.jpg", image)
save("image.png", image)
image.jpg (looks ok):
image.png (looks wrong):
EDIT: Better example
The text was updated successfully, but these errors were encountered:
IoachimusRoderici
changed the title
Weird result when saving matrix to png file
BUG: Weird result when saving matrix to png file
Feb 5, 2025
RGB24 is not as well supported as other Colorants. I haven't figured out how it's handled in the JPEG chain, but until someone implements something similar for PNGFiles.jl, one can convert image_to_write = RGBA{N0f8}.(image) before saving.
I have stored an image in a
Matrix{RGB24}
.When i save the image to a jpg file, i get the expected result. When i save the image to a png file, it looks very wrong.
I am using Julia v1.11.3 and Images v0.26.2.
Minimal Working Example:
image.jpg (looks ok):
image.png (looks wrong):
EDIT: Better example
The text was updated successfully, but these errors were encountered: