Reputation: 13
In the below code I was trying to make the red component of the first pixel to be zero.
julia> image1 = load("background1.png");
julia> x = image1[1].r
0.776N0f8
julia> image1[1].r = 0
ERROR: type RGBA is immutable
Turns out the RGBA type in Julia is immutable. Is there a way I could change the individual pixels (R, G & B components) of an image?
Upvotes: 1
Views: 424
Reputation: 19162
Just make a new RGB. It's cheap to do:
image1 = load("background1.png")
x = image1[1]
image1[1] = RGB(0,x.g,x.b)
Upvotes: 5