Fix: NewImageFromImage height incorrect.
Previously, the function broke on non-rectangular images. y needs to be multiplied by the horizontal width, not the image's reported height.
This commit is contained in:
parent
4b4860959e
commit
0a80f904b1
1 changed files with 1 additions and 1 deletions
|
@ -1113,7 +1113,7 @@ func NewImageFromImage(img image.Image) *Image {
|
||||||
for x := 0; x < size.X; x++ {
|
for x := 0; x < size.X; x++ {
|
||||||
color := img.At(x, y)
|
color := img.At(x, y)
|
||||||
r, g, b, a := color.RGBA()
|
r, g, b, a := color.RGBA()
|
||||||
pixels[x+y*size.Y] = NewColor(uint8(r), uint8(g), uint8(b), uint8(a))
|
pixels[x+y*size.X] = NewColor(uint8(r), uint8(g), uint8(b), uint8(a))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue