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
Running my gotour pic tutorial for an image of size 256x256, sometimes pic.ShowImage doesn't actually show the full image. It'll show an image of a smaller size (about 256x160) and print the rest of the data as an ASCII parsed string. Other times it shows the full 256x256 image.
The issue is that the backend is sometimes splitting the image data into two separate messages. The browser only sees the first one as an image. The backend should be smarter about splitting messages.
Context: http://127.0.0.1:3999/methods/16
Running my gotour pic tutorial for an image of size 256x256, sometimes pic.ShowImage doesn't actually show the full image. It'll show an image of a smaller size (about 256x160) and print the rest of the data as an ASCII parsed string. Other times it shows the full 256x256 image.
Code below:
package main
import (
"golang.org/x/tour/pic"
"image"
"image/color"
)
type Image struct {
W, H int
}
func (i Image) ColorModel() color.Model {
return color.RGBAModel
}
func (i Image) Bounds() image.Rectangle {
return image.Rect(0, 0, i.W, i.H)
}
func (i Image) At(x, y int) color.Color {
return color.RGBA{uint8(x^y), uint8(x*y), uint8((x+y)/2), 255}
}
func main() {
m := Image{256, 256}
pic.ShowImage(m)
}
The text was updated successfully, but these errors were encountered: