# 1st: Take a photo with portray image. # 2nd: Use this website to make passport photo: https://www.cutout.pro/passport-photo-maker/upload # 3nd: Download the transformation image above and run this code: from PIL import Image # Đường dẫn ảnh input_image_path = "your_transformed_image.jpg" # Thay bằng đường dẫn ảnh gốc output_image_path = "the_final_image_to_submit.jpg" # Mở ảnh image = Image.open(input_image_path) # Kích thước mong muốn (cm) width_cm, height_cm = 4, 6 dpi = 600 # Bạn có thể đặt giá trị cao hơn nếu muốn # Chuyển đổi kích thước từ cm sang pixel width_px = int(width_cm * dpi / 2.54) height_px = int(height_cm * dpi / 2.54) # Thay đổi kích thước ảnh image_resized = image.resize((width_px, height_px), Image.LANCZOS) # Lưu ảnh với DPI mong muốn image_resized.save(output_image_path, dpi=(dpi, dpi)) print(f"Ảnh đã được lưu với kích thước {width_cm}x{height_cm} cm và DPI {dpi}.")