ok.
then, it would be something along these lines (untested! some transpose mistakes are possible :P):
var (
width = 2048
height = 2448
)
s2 := make([]uint8, width*height*3)
// ...read from hdf5...
to1D := func(x, y, z int) int {
return (z * height * width) + (y * width) + x
}
// display the fields
fmt.Printf(":: size: length %v capacity %v\n", len(s2), cap(s2))
img := image.NewRGBA(image.Rect(0, 0, width, height))
for ix := 0; ix < width; ix++ {
for iy := 0; iy < height; iy++ {
ir := to1D(ix, iy, 0)
ig := to1D(ix, iy, 1)
ib := to1D(ix, iy, 2)
img.SetRGBA(ix, iy, color.RGBA{R: s2[ir], G: s2[ig], B: s2[ib], A: 255})
}
}