So here is a very simple 8x8 png image:
![]()
Opening it in GIMP:
So this pixel has RGBA(233, 173, 4, 244) components.
Using Python:
import imageio
img = imageio.imread('img.png')
r = img[:, :, 0]
g = img[:, :, 1]
b = img[:, :, 2]
a = img[:, :, 3]
print((r[2, 2], g[2, 2], b[2, 2], a[2, 2]))
gives (233, 173, 4, 244), so far so good.
Now using Julia:
using ColorTypes
using ImageMagick
using PNGFiles
for mod ∈ (ImageMagick, PNGFiles)
img = open("img.png") do io
kw = mod == PNGFiles ? (;expand_paletted=true) : ()
mod.load(io; kw...)
end
int255(c) = round.(Int, 255c)
r, g, b, a = int255(red.(img)), int255(green.(img)), int255(blue.(img)), int255(alpha.(img))
println((r[3, 3], g[3, 3], b[3, 3], a[3, 3]))
end
gives
(245, 215, 34, 244)
(245, 214, 39, 244)
Only the alpha channel is identical. G and B channels have different values using PNGFiles or ImageMagick. And the RGB values are far from what is displayed in GIMP or by using Python.
What am I missing here ?
