golang.org/x/image/draw extends Go’s standard image/draw package with image scaling and interpolation. Its Scaler interface shrinks or expands a rectangle from an input image into an output rectangle. section 9.6.2
Available Scaler implementations include:
- NearestNeighbor, which preserves sharp pixel edges. section 9.6.2
- CatmullRom and ApproxBiLinear, which provide alternative interpolation behavior. section 9.6.2
Scaling a maze frame into a GIF
Create a paletted frame with the maze’s aspect ratio, then call draw.NearestNeighbor.Scale(frame, frame.Rect, s.maze, s.maze.Bounds(), draw.Over, nil). Repeating this for explored-maze states produces animation frames.
