Proposal Details
In a high-concurrency environment and the image file is large, image.Decode will consume a lot of memory. Is it possible to provide a similar like json package NewDecoder function to write the decoded image to an external image object? User code can use sync.Pool to reuse the image object.
var imagePool = sync.Pool{
New: func() any {
return image.NewNRGBA(image.Rect(0, 0, 0, 0))
},
}
img := imagePool.Get().(*image.NRGBA)
image.NewDecoder(img).Decode(imageReader)
