📜 ⬆️ ⬇️

Another graphic display of Pi

The topic is not new, just type in the “graphic image of Pi” in the search to see this.

But the publication on this topic on this resource. To display the numbers, a conventional color is used here, and the coding is extremely simple - a palette of 10 colors, each randomly assigned color has its own digit.

To fill leisure, I set myself the task of displaying one million decimal places Pi in a conditional color, so that (almost) each sign was (conditionally) distinguishable by color, on a graphic image without a special increase, and there was at least some logic in choosing the encoding method.

In the standard RGB model, three bytes are used to encode one pixel, one for each color. We take advantage of this circumstance and define the conditional color as follows - every 9 consecutive digits determine the color of one pixel, the first three R-components, the next three G-components, the last three of the nine B-components. Further, the next pixel is encoded in the same way. Since the maximum value of the three-digit decimal number is 999, and the eight-digit binary value is 255, we will scale to the range 0 - 255. Now it became clear why in the previous paragraph the word “almost” appears in brackets. Place the dots in a square raster. We determine the number of points: 334 x 334 x 9 = 1 004 004 is enough for a million characters. But the number 334 (completely subjective) is ugly, another thing is 333 - the soul rejoices, though we won’t get to a million: 333 x 333 x 9 = 998001, let's not be trivial.
')
Programming the creation of pictures is an easy task, since displaying the required number of characters in binary coded decimal form was easily found on the Internet. Originally created a file in bmp format, then in a graphic editor translated into jpg.

The raster starts from the bottom left point. For convenience of viewing on the monitor screen, each calculated pixel is represented in the picture by a 3x3 square, i.e. the dimension of the picture is 999x999. And here is the image:



When zooming out, the picture becomes gray, half the brightness, which indicates the color balance, in other words, the RGB cube volume is evenly filled with pixels.

It is interesting how Photoshop filters behave with this image, for example, Equaiize does not change the picture, Invert of course turns the colors, but after a second, it seems that nothing has changed, when using Blur Average, the picture disappears (if the background in Photoshop is set as 50% gray - by default), Stylize Trace contour refuses to create contours, and many more interesting things, see for yourself.

Source: https://habr.com/ru/post/395809/


All Articles