Skip to content
An image distorter which uses randomly-generated functions
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
autodistortion
autoutils
LICENSE
README.md
main.go
worldmap.jpg
worldmap_distorted.jpg

README.md

AutoDistortion

Distortion of images using randomly-generated functions.

There is now a web version of AutoDistortion (but it's slower).

A world map distorted using AutoDistortion

This was generated using AutoDistortion from the following image (Sourced from here)

A world map

To run AutoDistortion on an image, download one of the releases, and run the executable. You will be prompted for the name of the image file.

Only PNG and JPG images are supported so far.

How it works

AutoDistortion works by randomly generating two functions, X(x, y) and Y(x, y), for example:

X(x, y) = 2x + 3y
Y(x, y) = sin(7y)

Then, the color of the pixel at (x, y) in the output image will be the color of the pixel at (X(x, y) modulo width, Y(x, y) modulo height) in the input image (where width and height are the dimensions of the input image).

To make sure that images at different resolutions are treated the same, AutoDistortion divides x and y by the width and height of the image respectively before doing this.

Building AutoDistortion from source

To build AutoDistortion, simply run

go get github.com/pommicket/autodistortion
cd $GOPATH/github.com/pommicket/autodistortion
mkdir -p bin
go build -o bin/autodistortion

Arguments

You can see a list of command line arguments using

autodistortion -help

These include:

  • -in, -out - Set the input and output files respectively
  • -seed - Sets the seed for the random number generator (default to the time in nanoseconds). This is useful for distorting multiple images with the same distortion.
  • -threads - Sets the number of threads to use (defaults to 64)

License

AutoDistortion is licensed under the GNU General Public License, Version 3.

You can’t perform that action at this time.