Today, I worked with art artificial intelligence, to create tool for my game development.
I used python and PyQt6 and this tool help me to remove border, resize, split, rename and save images as PNG file type for Godot game engine.



Is a blog about python programming language. You can see my work with python programming language, tutorials and news.
from PIL import Image, ImageDraw
# 640x640 pixeli with 10x10 squares 64x64
img = Image.new('RGB', (640, 640))
draw = ImageDraw.Draw(img)
# color list
colors = []
# for 100 colors you need to set steps with 62,62,64
# or you can change 64,62,62 some little changes
for r in range(0, 256, 62):
for g in range(0, 256, 62):
for b in range(0, 256, 64):
colors.append((r, g, b))
# show result of colors and size up 100 items
print(colors)
print(len(colors))
# create 10x10 colors and fill the image
for i in range(10):
for j in range(10):
x0 = j * 64
y0 = i * 64
x1 = x0 + 64
y1 = y0 + 64
color = colors[i*10 + j] # Selectarea culorii din lista
draw.rectangle([x0, y0, x1, y1], fill=color)
# save teh image
img.save('rgb_color_matrix.png')
C:\PythonProjects\ConvertImages>python -m pip install --upgrade pip
Requirement already satisfied: pip in c:\python311alpha\lib\site-packages (22.1.
2)
Collecting pip
Downloading pip-22.2-py3-none-any.whl (2.0 MB)
---------------------------------------- 2.0/2.0 MB 3.3 MB/s eta 0:00:00
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 22.1.2
Uninstalling pip-22.1.2:
Successfully uninstalled pip-22.1.2
Successfully installed pip-22.2
C:\PythonProjects\ConvertImages>python -m pip install --upgrade Pillow
Collecting Pillow
Downloading Pillow-9.2.0-cp311-cp311-win_amd64.whl (3.3 MB)
---------------------------------------- 3.3/3.3 MB 4.0 MB/s eta 0:00:00
Installing collected packages: Pillow
Successfully installed Pillow-9.2.0
from PIL import Image
# open the image file WEBP
image = Image.open('waterski2.webp')
# show the image
image.show()
# convert the image to RGB color
image = image.convert('RGB')
# save PNG RGB image
image.save('waterski2_RGB_PNG.png', 'png')
# save JPG RGB image
image.save('waterski2_RGB_JPG.jpg', 'jpeg')
# open the image file JPG
image_jpg = Image.open('waterski2_RGB_JPG.jpg')
# convert the image to RGB color
image_rgb_jpg = image_jpg.convert('RGB')
# save PNG RGB image from JPG
image_rgb_jpg.save('new-image_RGB_PNG_from_JPG.png', 'png')
#same process of conversion to WEBP file type
# from png image
image = Image.open('waterski2_RGB_PNG.png')
image = image.convert('RGB')
image.save('new-image_RGB_WEBP_from_png.webp', 'webp')
# from jpg image
image = Image.open('waterski2_RGB_JPG.jpg')
image = image.convert('RGB')
image.save('new-image_RGB_WEBP_from_jpg.webp', 'webp')