From Esolang
Jump to: navigation, search

ImageFuck is an esoteric programming language created by user:Insanity. In its essence, ImageFuck is a version of Brainfuck created by altering pixels of an image. It supports the same operators as Brainfuck and will actually compile to Brainfuck code before being run through a Brainfuck interpreter.

As Brainfuck is a Turing Complete language, so is this version which is really a layer on top of Brainfuck. And just like Brainfuck, any colour appearing in the image that is not defined as an operator is considered a comment. You can make an entire picture and hide some ImageFuck code in it by colouring just specific pixels.

Pixels are read from left to right, row after row.

The source code for ImageFuck is in this Github Repository and includes examples of how to use the language. It is written in Python and includes a tool to go from existing Brainfuck code to an ImageFuck image.

For example, the first 7 numbers of the Fibonacci sequence can be created by running this image.

The various operators of brainfuck are made by these pixel colours

Colour (RGB) BrainFuck code
(255,0,0) >
(0,255,0) .
(0,0,255) <
(255,255,0) +
(0,255,255) -
(255,0,188) [
(255,128,0) ]
(102,0,204) ,

As these values need to be set 'exactly', the files can not deal with compression. If you use .jpeg for example the resulting code will be _wrong_.

PNG files are better suited for this as they are lossless.