Sawuare's Site

HPQ Images

HPQ images are mathematical images. I discovered them around 2019.

Software

These programs and libraries are part of Misk. I use hpq-fb to explore the images and hpq-png to save them.

Definition

In an HPQ image, a function p#(q, (x, y)) is applied to every pixel. The #, q, x, y, and output of the function are nonnegative integers. The function is called a painter. The # is called the identifier (ID). The q is called the q-argument. The x and y are the horizontal and vertical coordinates of a pixel, respectively. Pixel (x, y) is white if p#(q, (x, y)) = 0, otherwise it is black.

For pixel (x, y), the pixel to its right is at (x + 1, y), and the pixel below it is at (x, y + 1). The top-left pixel is at (x0, y0), where x0 and y0 are nonnegative integers called x-offset and y-offset, respectively. Pixel (0, 0) is called the origin.

There are 40 defined painters, 0 through 39, divided into 8 classes, 0 through 7. They are defined in such a way that p#(q, (x, y)) = p#(q, (y, x)). Painters in classes 1, 3, 5, and 7 divide by q, so q = 0 is undefined for them. The following is a list of all painters, where & denotes bitwise AND, | denotes bitwise inclusive OR, ^ denotes bitwise exclusive OR, * denotes multiplication, which has the highest precedence, and % denotes modulo:

Example

For an HPQ image with width 3, height 2, x-offset x0 = 1, and y-offset y0 = 2, the pixels have the following coordinates:

(1, 2)(2, 2)(3, 2)
(1, 3)(2, 3)(3, 3)

Painter 8 with q-argument 4 is applied to every pixel as follows:

The pixels are colored as follows:

BlackWhiteBlack
WhiteBlackBlack

Pixel (2, 2) is white because p8(4, (2, 2)) = 0. Pixel (1, 2) is black because p8(4, (1, 2)) ≠ 0.

Observations

Demo

Here is an interactive demo of HPQ images. It has options that let you select a painter and input its q-argument to paint a canvas. Note that the options are limited in comparison with those of the main program hpq-png.

Some options of the demo and main programs
Program Painter Q-argument Offset Length
Demo 8 or 22 1 to 4294967295 0 256
Main 0 to 39 0 to 4294967295 0 to 4294967295 1 to 32768
Options

Canvas

Gallery

Here are some images written using hpq-png. They are 256 pixels in width and height. Their captions show the painter and q-argument used.

p0 q192
p1 q192
p2 q192
p3 q192
p4 q192
p5 q19
p6 q19
p7 q19
p8 q19
p9 q19
p10 q4096
p11 q4096
p12 q4096
p13 q4096
p14 q1048576
p18 q136
p21 q223
p22 q2040
p25 q136
p26 q15
p27 q15
p29 q4097
p30 q2064
p32 q224
p35 q20
p36 q15
p37 q15
p39 q1048577