Converting an image into an image of RGB dots (half-tinted effect)

I am trying to show students how the RGB color model works in order to create a specific color (or, moreover, to convince them that this is true). Therefore, I want to take a picture and convert each pixel to an RGB representation, so that when you enlarge the image, instead of a single color pixel, you see RGB colors.

I did this, but for some obvious reason, the converted image is either washed out or darker than the original (which is a minor inconvenience, but I think it would be more powerful if I could get it bigger than the original).

Here are two “enlarged” snapshots: Liko Zoomed Out

Here is the "medium zoom" starting to show RGB artifacts in the converted image:

Like medium zoom

And here is the picture, enlarged to such an extent that you can clearly see the individual pixels and squares of RGB:

Like Zoome In

You will notice a constant color surrounding the pixels; This is an average RGB image. I put this so that you can see individual pixels (otherwise you just see rows / columns of shades of red / green / blue). If I fully withstand this space, the image will be even darker, and if I replace it with white, then the image will disappear (if it is reduced).

I know why displaying this method makes it darker: “pure red” will have completely black blue and green. In a sense, if I were to make a completely red picture, it would essentially be 1/3 of the brightness of the original.

So my question is:

1: Are there any tools that already do this (or something similar)?

2: , ?

, , "RGB-" ( ), ? , , RGB ints 3 ( , ). , , ? -, ?

+4
3

, , 3. : RGB -, . - , , .

. 7/16 , , . 90 , , , .

, . - . . - , . , .

Python .

from PIL import Image
im = Image.open(filename)
im2 = Image.new('RGB', (im.size[0]*3, im.size[1]*3))
ld1 = im.load()
ld2 = im2.load()
for y in range(im.size[1]):
    for x in range(im.size[0]):
        rgb = ld1[x,y]
        rgb = [(c/255)**2.2 for c in rgb]
        rgb = [min(1.0,c*3) for c in rgb]
        rgb = tuple(int(255*(c**(1/2.2))) for c in rgb)
        x2 = x*3
        y2 = y*3
        if (x+y) & 1:
            for x3 in range(x2, x2+3):
                ld2[x3,y2] = (rgb[0],0,0)
                ld2[x3,y2+1] = (0,rgb[1],0)
                ld2[x3,y2+2] = (0,0,rgb[2])
        else:
            for y3 in range(y2, y2+3):
                ld2[x2,y3] = (rgb[0],0,0)
                ld2[x2+1,y3] = (0,rgb[1],0)
                ld2[x2+2,y3] = (0,0,rgb[2])

enter image description here

+3

. , . , .

, .

, , , , , RGB .

+2

? , RGB .

, , , .

, .

enter image description here

+1
source

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


All Articles