PQ images are a kind of mathematical art. I discovered them circa 2019.
Definition
In a PQ 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 50 defined painters, 0 through 49, divided into 10 classes, 0 through 9.
They are defined in such a way that p#(q, (x, y)) = p#(q, (y, x)).
Painters in odd classes 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:
- Class 0
- p0 = (x & y) & q
- p1 = (x | y) & q
- p2 = (x ^ y) & q
- p3 = (x + y) & q
- p4 = (x * y) & q
- Class 1
- p5 = (x & y) % q
- p6 = (x | y) % q
- p7 = (x ^ y) % q
- p8 = (x + y) % q
- p9 = (x * y) % q
- Class 2
- p10 = (x * x & y * y) & q
- p11 = (x * x | y * y) & q
- p12 = (x * x ^ y * y) & q
- p13 = (x * x + y * y) & q
- p14 = (x * x * y * y) & q
- Class 3
- p15 = (x * x & y * y) % q
- p16 = (x * x | y * y) % q
- p17 = (x * x ^ y * y) % q
- p18 = (x * x + y * y) % q
- p19 = (x * x * y * y) % q
- Class 4
- p20 = (q * x & q * y) & q
- p21 = (q * x | q * y) & q
- p22 = (q * x ^ q * y) & q
- p23 = (q * x + q * y) & q
- p24 = (q * x * q * y) & q
- Class 5
- p25 = (q * x & q * y) % q
- p26 = (q * x | q * y) % q
- p27 = (q * x ^ q * y) % q
- p28 = (q * x + q * y) % q
- p29 = (q * x * q * y) % q
- Class 6
- p30 = ((q & x) * x & (q & y) * y) & q
- p31 = ((q | x) * x & (q | y) * y) & q
- p32 = ((q ^ x) * x & (q ^ y) * y) & q
- p33 = ((q + x) * x & (q + y) * y) & q
- p34 = ((q * x) * x & (q * y) * y) & q
- Class 7
- p35 = ((q & x) * x & (q & y) * y) % q
- p36 = ((q | x) * x & (q | y) * y) % q
- p37 = ((q ^ x) * x & (q ^ y) * y) % q
- p38 = ((q + x) * x & (q + y) * y) % q
- p39 = ((q * x) * x & (q * y) * y) % q
- Class 8
- p40 = ((q & x) * x + (q & y) * y) & q
- p41 = ((q | x) * x + (q | y) * y) & q
- p42 = ((q ^ x) * x + (q ^ y) * y) & q
- p43 = ((q + x) * x + (q + y) * y) & q
- p44 = ((q * x) * x + (q * y) * y) & q
- Class 9
- p45 = ((q & x) * x + (q & y) * y) % q
- p46 = ((q | x) * x + (q | y) * y) % q
- p47 = ((q ^ x) * x + (q ^ y) * y) % q
- p48 = ((q + x) * x + (q + y) * y) % q
- p49 = ((q * x) * x + (q * y) * y) % q
Example
For a PQ 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:
- p8(4, (1, 2)) = (1 + 2) % 4 = 3
- p8(4, (2, 2)) = (2 + 2) % 4 = 0
- p8(4, (3, 2)) = (3 + 2) % 4 = 1
- p8(4, (1, 3)) = (1 + 3) % 4 = 0
- p8(4, (2, 3)) = (2 + 3) % 4 = 1
- p8(4, (3, 3)) = (3 + 3) % 4 = 2
The pixels are colored as follows:
Black | White | Black
|
White | Black | Black
|
Pixel (2, 2) is white because p8(4, (2, 2)) = 0. Pixel (1, 2) is black because p8(4, (1, 2)) ≠ 0.