Creats suitable round images for stickers in TG.
My friend asked me to crop some images for him. At first I was doing it manually. But he saw my struggle and proposed to Python it. And it is my result.
- Any basic Python IDE or Shell.
- Not being dumb-ass.
- Love dots.
- Put your images in input folder.
- Run imager.py.
- Proceed in terminal.
We detected such images to crop:
name#1
name#2
...
Do you want to proceed(Y,N)?
Do you want to keep original names (Y/N)?
- Get your stickers in output folder.
name#1 is done.
name#2 is done.
...
- You are brilliant! You are able to find your pngs in output folder.
You can just look to source code or read further:
- Make a list of image names in input folder.
- After that we iterate through each name in a list
- Opening an Image.
- Cropping it to square which is centered.
- Resizing image to 512x512.
- Creating a round mask of suitable size.
- Putting alpha mask.
- Saving image with according filename.
- Putting my sticker in output folder so that everyone knows who done this amazing sticker pack!