File:CRT image creation animation.gif

CRT_image_creation_animation.gif(546 × 532 pixels, file size: 6.61 MB, MIME type: image/gif, looped, 192 frames, 3.8 s)

Note: Due to technical limitations, thumbnails of high resolution GIF images such as this one will not be animated.

Commons-logo.svg This is a file from the Wikimedia Commons. The description on its description page there is shown below.
Commons is a freely licensed media file repository. You can help.

Summary

Description
Deutsch: Animation des Bildaufbaus bei einer Kathodenstrahlröhre mit Interlacing-Verfahren.
English: Animation of the image construction for a cathode ray tube with interlacing method.
Date
Source Own work
Author Laserlicht

Code

#Path to Cairo Lib
import os
os.environ["PATH"] = r"D:\Programme\msys64\mingw64\bin" + os.pathsep + os.environ["PATH"]

#Imports
import drawSvg as draw
from PIL import Image
import numpy as np
import webbrowser

#Global Settings
in_img = "img3.jpg"
intensity_multiplicator = 0.990

#Image
im = Image.open(in_img)
pix = np.array(im)
pix = np.transpose(pix, (1, 0, 2))
intensity = np.arange(pix.shape[0] * pix.shape[1], dtype=np.float64).reshape(pix.shape[0], pix.shape[1])
intensity[:] = 0.0

def render(f):
    global im, intensity

    #Settings / Objects
    size = (600, 600)
    d = draw.Drawing(size[0], size[1], origin=(0, 0), displayInline=False)
    d.append(draw.Rectangle(0, 0, size[0], size[1], fill="#ffffff", fill_opacity=1.0))

    #Draw
    draw_area = (50, 50 + 100, (280/3) * 4, 280)
    gap = (draw_area[2] / pix.shape[0], draw_area[3] / pix.shape[1])

    #   Antenna
    gradient = draw.LinearGradient(draw_area[0], draw_area[1], draw_area[0] + draw_area[2], draw_area[1] + draw_area[3])
    gradient.addStop(0, '#aaaaaa', 1)
    gradient.addStop(1, '#eeeeee', 1)
    gradient = '#cccccc' #overwrite gradient -> disable, because better for gif

    p = draw.Path(stroke_width=2, stroke="#000000", fill=gradient, fill_opacity=1.0)
    p.M(280, 460)
    p.A(10, 10, 0, 0, 1, 300, 460)
    d.append(p)
    d.append(draw.Line(290, 470, 290 + 90, 470 + 90, stroke='black', stroke_width=2, fill='none'))
    d.append(draw.Circle(290 + 90, 470 + 90, 7, fill='black', stroke_width=2, stroke='black'))
    d.append(draw.Line(290, 470, 290 - 120, 470 + 120, stroke='black', stroke_width=2, fill='none'))
    d.append(draw.Circle(290 - 120, 470 + 120, 7, fill='black', stroke_width=2, stroke='black'))

    #   Foot
    p = draw.Path(stroke_width=2, stroke="#000000", fill=gradient, fill_opacity=1.0)
    p.M(290+100, 120)
    p.L(290+100+50, 120-50)
    p.L(290+100+20, 120)
    d.append(p)
    p = draw.Path(stroke_width=2, stroke="#000000", fill=gradient, fill_opacity=1.0)
    p.M(290-100, 120)
    p.L(290-100-50, 120-50)
    p.L(290-100-20, 120)
    d.append(p)

    #   TV housing
    d.append(draw.Rectangle(20, 20 + 100, 540, 340, rx=50, ry=50, fill=gradient, fill_opacity=1.0, stroke="#000000", stroke_width=2))

    #   Blackscreen
    d.append(draw.Rectangle(50, 50 + 100, (280/3)*4, 280, rx=10, ry=10, fill="#000000"))

    #   Display
    while f >= pix.shape[0] * pix.shape[1]: f -= pix.shape[0] * pix.shape[1]
    radius = min(gap[0], gap[1]) / 2
    intensity[:] *= intensity_multiplicator
    for x in range(pix.shape[0]):
        for y in range(pix.shape[1]):
            point_pos = (f % pix.shape[0], f // pix.shape[0])

            if point_pos[1] < pix.shape[1] / 2:
                y_pos = (point_pos[1] * 2 == y)
            else:
                y_pos = (((point_pos[1] - pix.shape[1] / 2) * 2) + 1 == y)

            if point_pos[0] == x and y_pos:
                color = "#ffffff"
                intensity[x, y] = 1.0
            else:
                color = tuple((pix[x][y] * intensity[x][y]).astype(int))
                color = '#%02x%02x%02x' % color
           
            d.append(draw.Circle(draw_area[0] + x * gap[0] + radius, draw_area[1] + draw_area[3] - y * gap[1] - radius, radius, fill=color))

    #   TV
    #       Screen (only Border)
    d.append(draw.Rectangle(50 - 5, 50 + 100 - 5, (280/3)*4 + 10, 280 + 10, rx=15, ry=15, fill="#000000", fill_opacity=0.0, stroke=gradient, stroke_width=10)) #hacky overdraw overlapping circles -> masks don't work...
    d.append(draw.Rectangle(50, 50 + 100, (280/3)*4, 280, rx=10, ry=10, fill="#000000", fill_opacity=0.0, stroke="#000000", stroke_width=2))

    #       Controls
    d.append(draw.Rectangle(75 + (280/3)*4, 130 + 100, 455 - (280/3)*4, 200, rx=10, ry=10, fill="#000000", fill_opacity=0.0, stroke="#000000", stroke_width=2))

    d.append(draw.Circle(75 + (280/3)*4 + 40, 130 + 100 + 160, 25, fill='#888888', stroke_width=2, stroke='black'))
    d.append(draw.Circle(75 + (280/3)*4 + 40, 130 + 100 + 90, 25, fill='#888888', stroke_width=2, stroke='black'))
    d.append(draw.Rectangle(75 + (280/3)*4 + 40, 130 + 100 + 160 - 5, 20, 10, rx=10, ry=10, fill="#888888", fill_opacity=0.0, stroke="#000000", stroke_width=2))
    d.append(draw.Rectangle(75 + (280/3)*4 + 40 - 5, 130 + 100 + 90, 10, 20, rx=10, ry=10, fill="#888888", fill_opacity=0.0, stroke="#000000", stroke_width=2))

    #       Speaker
    for i in range(6):
        p = draw.Path(stroke_width=2, stroke="#000000", fill='black', fill_opacity=0.0)
        p.M(75 + (280/3)*4, 130 + 100 - 20 - 10 * i)
        p.H(75 + (280/3)*4 + 80)
        d.append(p)

    #Output
    d.setRenderSize(size[0], size[1])

    return d

#Prefill Intensity Values
for i in range(pix.shape[0] * pix.shape[1]):
    render(i)

#Render to Images
with draw.animate_video("video.tiff", render) as anim:
    for i in range(pix.shape[0] * pix.shape[1]):
        anim.draw_frame(i)

#Render to SVG/PNG
#d = render(0)
#d.saveSvg("a.svg")
#d.savePng("a.png")

#View
webbrowser.open('file://' + os.path.realpath("video.tiff"))
input()

Licensing

Image:

I, the copyright holder of this work, hereby publish it under the following license:
w:en:Creative Commons
attribution share alike
This file is licensed under the Creative Commons Attribution-Share Alike 4.0 International license.
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.

Source:

This file is licensed under the Expat License, sometimes known as the MIT License:

Copyright © Laserlicht

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

The Software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the Software or the use or other dealings in the Software.


To uploader: MIT License has various versions, you may want to specify the license more precisely. Click {{MIT}} to see details.

This image has been assessed using the Quality image guidelines and is considered a Quality image.

العربية  جازايرية  беларуская  беларуская (тарашкевіца)  български  বাংলা  català  čeština  Cymraeg  Deutsch  Schweizer Hochdeutsch  Zazaki  Ελληνικά  English  Esperanto  español  eesti  euskara  فارسی  suomi  français  galego  עברית  हिन्दी  hrvatski  magyar  հայերեն  Bahasa Indonesia  italiano  日本語  Jawa  ქართული  한국어  kurdî  Lëtzebuergesch  lietuvių  македонски  മലയാളം  मराठी  Bahasa Melayu  Nederlands  Norfuk / Pitkern  polski  português  português do Brasil  rumantsch  română  русский  sicilianu  slovenčina  slovenščina  shqip  српски / srpski  svenska  தமிழ்  తెలుగు  ไทย  Tagalog  toki pona  Türkçe  українська  vèneto  Tiếng Việt  中文  中文(简体)  中文(繁體)  +/−

Captions

Add a one-line explanation of what this file represents

Items portrayed in this file

depicts

7 November 2021

image/gif

8d26037a7a752fe6aef5f771c3387417437262e1

6,930,521 byte

3.840000000000003 second

532 pixel

546 pixel

File history

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

Date/TimeDimensionsUserComment
current11:42, 7 November 2021546 × 532 (6.61 MB)Laserlichtcomment edit

The following 2 pages use this file:

Metadata