arotationnaiv.py

Created by bilouclic

Created on December 16, 2024

469 Bytes


def quart_de_tour_naif(nom_fichier : str) -> None:
    ''' Construit une nouvelle image correspondant au résultat de l'application d’un quart de tour dans le sens horaire
    '''
    img = Image.open(nom_fichier)
    n, hauteur = img.width, img.height
    assert n == hauteur
    nv_img = Image.new('RGB', (n,n))
    for x in range(n) :
        for y in range(n) :
            nv_img.putpixel( (x,y), img.getpixel( (y, n-1-x) ) )
    nv_img.show()

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.