Add match
statement
This commit is contained in:
parent
be91a07dd5
commit
3636335b63
@ -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')
|
Loading…
Reference in New Issue
Block a user