Advertisement
illwieckz

splitnh

Sep 7th, 2024
431
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. #! /usr/bin/env python3
  2. import sys
  3. from PIL import Image
  4. if len(sys.argv) > 1:
  5.     name = sys.argv[1]
  6.     with Image.open(name) as input_image:
  7.         rgba_image = input_image.convert('RGBA')
  8.         rgb_image = rgba_image.convert('RGB')
  9.         alpha_image = rgba_image.split()[-1]
  10.         base_name = ".".join(name.split(".")[:-1])
  11.         rgb_image.save(base_name + "_n.tga")
  12.         alpha_image.save(base_name + "_h.tga")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement