Re: [go-nuts] Re: Drawing millions of images on a bigger canvas

2022-01-24 Thread Robert Engels
Many image formats support tiling so you don’t need to have the entire image in memory (since a very large image is usually scaled or only a portion used at a time). > On Jan 24, 2022, at 10:07 AM, Howard C. Shaw III > wrote: > >  > One more options to add to Tamás' suggestions - due to

[go-nuts] Re: Drawing millions of images on a bigger canvas

2022-01-24 Thread Howard C. Shaw III
One more options to add to Tamás' suggestions - due to Go's interface design, implementing a draw.Image, which is an image.Image with an additional Set(x, y int, c color.Color) method, is sufficient to use draw.Draw for compositing. As such, you can pre-allocate a flat-file with sufficient

[go-nuts] Re: Drawing millions of images on a bigger canvas

2022-01-22 Thread Tamás Gulácsi
A large canvas needs large amount of memory. 32x35x4 byte is about 4.4Kib, so one million is 4272Mib. Just as your MemProfile says. Either use some image format that can be written in chunks (AFAIK PNG can do this, but that's quite low-level), or mmap the region of the pixels, or leave it to tho