File:One million dots 1080p.png

From testwiki
Jump to navigation Jump to search
    Original file (1,920 × 1,080 pixels, file size: 8 KB, MIME type: image/png)

    This file is from Wikimedia Commons and may be used by other projects. The description on its file description page there is shown below.

    Summary

    Description
    English: Full HD visualisation of exactly one million black dots (pixels) in 100 groups of 10000. For comparison, each tile with white or grey background contains 1000 black dots.
    Date
    Source Own work
    Author Cmglee
    PNG development
    InfoField
     This PNG graphic was created with Python.

    Python source code

    # one_million_dots_1080p.py
    import png
    
    def draw_pixel(pixels, width, x, y, rrggbb):
     offset_r  = (width * y + x) * 3
     pixels[offset_r    ] = int(rrggbb[-6:-4], 16)
     pixels[offset_r + 1] = int(rrggbb[-4:-2], 16)
     pixels[offset_r + 2] = int(rrggbb[-2:  ], 16)
    
    width_1k    = 19
    height_1k   = 106
    width_10k   = 10 * width_1k
    height_1m   = 1080
    width_1m    = 1920
    excludess   = [(18,0),(18,2),(18,4),(18,6),(18,100),(18,102),(18,104)]
    skips       = [2,1,2,1,2, 4, 2,1,2,1,2]
    skip_cumuls = [sum(skips[:i + 1]) for i in range(len(skips))]
    out_pixels  = [248 for i in range(width_1m * height_1m * 3)]
    height_1k_minus_1 = height_1k - 1
    width_1k_minus_1  = width_1k  - 1
    for x_1m in range(10):
     print(x_1m)
     for y_1m in range(10):
      for x_10k in range(10):
       is_x_1m_multiple_of_2  = x_1m  % 2 == 0
       is_x_10k_multiple_of_2 = x_10k % 2 == 0
       is_checker_grey        = (x_10k + y_1m) % 2 == 0
       for y_1k in range(height_1k):
        for x_1k in range(width_1k):
         x = x_1k if (not is_x_1m_multiple_of_2) else width_1k_minus_1  - x_1k
         y = y_1k if (is_x_10k_multiple_of_2   ) else height_1k_minus_1 - y_1k
         draw_pixel(out_pixels, width_1m,
                    x_1m * width_10k + skip_cumuls[x_1m] + x_10k * width_1k + x,
                    y_1m * height_1k + skip_cumuls[y_1m]                    + y,
                    '#000000' if ((x_1k + y_1k) % 2 == 0 and (x_1k, y_1k) not in excludess) else
                    ('#eeeeee' if (is_checker_grey) else '#ffffff'))
    f_out = png.Writer(width=width_1m, height=height_1m, alpha=False)
    f_out.write_array(open('%s.png' % (__file__[:__file__.rfind('.')]), 'wb'), out_pixels)
    


    Licensing

    Cmglee, the copyright holder of this work, hereby publishes it under the following licenses:
    w:en:Creative Commons
    attribution share alike
    This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
    Attribution:
    You are free:
    • to share – to copy, distribute and transmit the work
    • to remix – to adapt the work
    Under the following conditions:
    • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
    • share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
    GNU head Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled GNU Free Documentation License.
    You may select the license of your choice.

    Captions

    Add a one-line explanation of what this file represents

    Items portrayed in this file

    depicts

    7,991 byte

    1,080 pixel

    1,920 pixel

    image/png

    578157c647a0bca2fc63a7baa10e6e575a8889cf

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current00:05, 29 August 2017Thumbnail for version as of 00:05, 29 August 20171,920 × 1,080 (8 KB)wikimediacommons>Cmglee{{Information |Description ={{en|1=Full HD visualisation of exactly one million black dots (pixels) in 100 groups of 10000. For comparison, each tile with white or grey background contains 1000 black dots. }} |Source ={{own}} |Author...

    There are no pages that use this file.