Created
January 13, 2026 06:05
-
-
Save iacchus/2c0bdb0c35e312c4bdb0a629d7b0a2f1 to your computer and use it in GitHub Desktop.
Android's Color Gear Strip Exported Palette Image's Watermark (for Termux)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/data/data/com.termux/files/usr/bin/env python | |
| import sys | |
| from wand.image import Image | |
| filename = sys.argv[1] | |
| img = Image(filename=filename) | |
| width = img.width | |
| new_height = img.height - 210 | |
| img.crop(width=width, height=new_height, gravity="north") | |
| img.trim(fuzz=0, reset_coords=True) | |
| top_left_color = img[0, 0] | |
| img.background_color = top_left_color | |
| img.splice(width=0, height=200, gravity="north") | |
| print(img.background_color) | |
| img.format = "png" | |
| new_filename = f"{filename.split('.')[0]}.png" | |
| img.save(filename=new_filename) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment