Add match statement

This commit is contained in:
Benjamin Loison 2024-04-18 00:52:08 +02:00
parent be91a07dd5
commit 3636335b63
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8

View File

@ -1,15 +1,36 @@
from PIL import Image
from utils import Color
def getImageFileNameByColor(color):
return f'mean_flat-field_nef_wavelet_{color}.png'
def getImageByColor(color):
return Image.open(f'mean_flat-field_nef_wavelet_{color}.png')
color = Color.BLUE
image = Image.open(getImageFileNameByColor(color))
#print(image.size)
image = getImageByColor(color)
height, width = image.size
newImage = Image.new('RGB', [dimension * 2 for dimension in image.size])
#print(newImage.size)
multipleColorsImage = Image.new('RGB', [dimension * 2 for dimension in image.size])
for color in Color:
getImageFileNameByColor(color)
colorImage = getImageByColor(color)
for y in range(height):
for x in range(width):
pixel = colorImage.getpixel(x, y)
'''
RG
GB
'''
newX, newY = {
Color.RED: 2 * x, 2 * y,
Color.GREEN_RIGHT: 2 * x, 2 * y,
Color.GREEN_BOTTOM: 2 * x, 2 * y,
Color.BLUE: 2 * x, 2 * y,
}[color]
match color:
case Color.RED:
newX, newY = 2 * x, 2 * y
case Color.GREEN_RIGHT:
newX, newY = 2 *
multipleColorsImage.putpixel((x, y), pixel)
multipleColorsImage.save('multipleColors.png')