# Path: pixelsort/constants.py



from PIL import Image, ImageFilter
from pixelsort import constants
from pixelsort import util
import random as rand

    filter_pixels = []
    edge_pixels = []
    intervals = []

    
    for y in range(img.size[1]):
        filter_pixels.append([])
        for x in range(img.size[0]):
            filter_pixels[y].append(edge_data[x, y])

    
    for y in range(len(pixels)):
        edge_pixels.append([])
        for x in range(len(pixels[0])):
            if util.lightness(filter_pixels[y][x]) < 0.25:
                edge_pixels[y].append(constants.white_pixel)
            else:
                edge_pixels[y].append(constants.black_pixel)

    
    for y in range(len(pixels) - 1, 1, -1):
        for x in range(len(pixels[0]) - 1, 1, -1):
            if edge_pixels[y][x] == constants.black_pixel and edge_pixels[y][x - 1] == constants.black_pixel:
                edge_pixels[y][x] = constants.white_pixel

    
    for y in range(len(pixels)):
        intervals.append([])
        for x in range(len(pixels[0])):

# Path: pixelsort/constants.py



# Path: pixelsort/interval.py
from PIL import Image, ImageFilter
from pixelsort import constants
from pixelsort import util
import random as rand


    filter_pixels = []
    edge_pixels = []
    intervals = []

    
    for y in range(img.size[1]):
        filter_pixels.append([])
        for x in range(img.size[0]):
            filter_pixels[y].append(edge_data[x, y])

    
    for y in range(len(pixels)):
        edge_pixels.append([])
        for x in range(len(pixels[0])):
            if util.lightness(filter_pixels[y][x]) < 0.25:
                edge_pixels[y].append(constants.white_pixel)
            else:
                edge_pixels[y].append(constants.black_pixel)

    
    for y in range(len(pixels) - 1, 1, -1):
        for x in range(len(pixels[0]) - 1, 1, -1):
            if edge_pixels[y][x] == constants.black_pixel and edge_pixels[y][x - 1] == constants.black_pixel:
                edge_pixels[y][x] = constants.white_pixel

    
    for y in range(len(pixels)):
        intervals.append([])
        for x in range(len(pixels[0])):

            if edge_pixels[y][x] == constants.black_pixel: