/go_resize

resizing images in Go

Primary LanguageGo

go_resize

By Brian Neville

This is an image resizing tool that I wrote.

The function 'Resize' takes in the filename of a png image, and will create a version of that file with the name 'resized_<filename>.png' and a resolution of twice the original.

created on: go version go1.12.9 windows/amd64

To use this, place the folder called 'resize' in the directory %GOROOT/src (e.g. the c:/go/src directory)

import using:

import(
  "resize"
  )

resize images with the function:

 resize.Resize("filename.png")

Note: this function currently only works on .png files

Examples:

scaling flat colors

img1

img11

scaling real images

img21

img21

scaling png images with complex borders

img31

img31

lenna (standard test image)

img41

img41

step by step progression

After every call to imgRGBA.Set(), I encoded the image as a new .png file. I then wrote a small python script to convert them all into into a gif:

img0