arotaplace.py

Created by bilouclic

Created on December 16, 2024

692 Bytes


def permutation_blocs(img : Image, zone=None):
    '''entrée : une image chargée avec le module PIL
                la zone de l'image à traiter
       sortie : aucune, la permutation des quadrants est effectuée "sur place"
    '''
    if zone is None : zone=(0,0,img.width,img.height)
    g,h,d,b = zone
    k = (d-g)//2
    assert (b-h)//2 == k
    for x in range(g,g+k):
        for y in range(h,h+k):
            tmp = img.getpixel( (x,y) )
            img.putpixel( (x,y), img.getpixel( (x,y+k) ) )
            img.putpixel( (x,y+k), img.getpixel( (x+k,y+k) ) )
            img.putpixel( (x+k,y+k), img.getpixel( (x+k,y) ) )
            img.putpixel( (x+k,y), tmp )

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.