Update: 2026-06-15 19:39:21
This commit is contained in:
BIN
scratch/car_marker_lady_1781540926836.png
Normal file
BIN
scratch/car_marker_lady_1781540926836.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 242 KiB |
BIN
scratch/car_marker_normal_1781540915043.png
Normal file
BIN
scratch/car_marker_normal_1781540915043.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 322 KiB |
BIN
scratch/category_comfort_1781540956914.png
Normal file
BIN
scratch/category_comfort_1781540956914.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 363 KiB |
BIN
scratch/category_electric_1781540970352.png
Normal file
BIN
scratch/category_electric_1781540970352.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 376 KiB |
BIN
scratch/category_fixed_price_1781540942631.png
Normal file
BIN
scratch/category_fixed_price_1781540942631.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 378 KiB |
BIN
scratch/category_lady_1781540984745.png
Normal file
BIN
scratch/category_lady_1781540984745.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 418 KiB |
56
scratch/process_images.py
Normal file
56
scratch/process_images.py
Normal file
@@ -0,0 +1,56 @@
|
||||
import os
|
||||
import sys
|
||||
from PIL import Image
|
||||
|
||||
def make_transparent_smooth(img_path, output_path, size):
|
||||
if not os.path.exists(img_path):
|
||||
print(f"Error: {img_path} does not exist.")
|
||||
return False
|
||||
|
||||
img = Image.open(img_path).convert("RGBA")
|
||||
img = img.resize(size, Image.Resampling.LANCZOS)
|
||||
|
||||
datas = img.getdata()
|
||||
new_data = []
|
||||
|
||||
for item in datas:
|
||||
r, g, b, a = item
|
||||
closeness = min(r, g, b)
|
||||
if closeness >= 240:
|
||||
if closeness >= 253:
|
||||
alpha = 0
|
||||
else:
|
||||
alpha = int(a * (253 - closeness) / (253 - 240))
|
||||
new_data.append((255, 255, 255, alpha))
|
||||
else:
|
||||
new_data.append(item)
|
||||
|
||||
img.putdata(new_data)
|
||||
img.save(output_path, "PNG")
|
||||
print(f"Successfully saved processed image to {output_path}")
|
||||
return True
|
||||
|
||||
if __name__ == "__main__":
|
||||
artifact_dir = "scratch"
|
||||
|
||||
|
||||
jobs = [
|
||||
("car_marker_normal_1781540915043.png", "siro_rider/assets/images/car.png", (80, 90)),
|
||||
("car_marker_normal_1781540915043.png", "siro_driver/assets/images/car.png", (80, 90)),
|
||||
("car_marker_lady_1781540926836.png", "siro_rider/assets/images/lady1.png", (80, 90)),
|
||||
("car_marker_lady_1781540926836.png", "siro_driver/assets/images/lady1.png", (80, 90)),
|
||||
("category_fixed_price_1781540942631.png", "siro_rider/assets/images/carspeed.png", (500, 500)),
|
||||
("category_comfort_1781540956914.png", "siro_rider/assets/images/blob.png", (500, 500)),
|
||||
("category_electric_1781540970352.png", "siro_rider/assets/images/electric.png", (500, 500)),
|
||||
("category_lady_1781540984745.png", "siro_rider/assets/images/lady.png", (500, 500)),
|
||||
]
|
||||
|
||||
|
||||
for src, dst, size in jobs:
|
||||
make_transparent_smooth(
|
||||
os.path.join(artifact_dir, src),
|
||||
dst,
|
||||
size
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user