Convert Images with Python Script

General / 13 July 2025
This post reads better on my tech art blog!

Recently I've ran into a issue when using conversion sites to bulk convert a lot of my pictures to webp. Due to my large blogging habits I tend to run out of enough "credits" to convert the rest of all my pictures. Webp is a brilliant format, super optimised probably one of my top ones if I had a tier list (gif is number 1 moving funny images are hard to beat) so I made my own converter. It uses Python 3.11 but may run on lower versions too.

How the Script Looks


This script can:

  • Convert images solo or in bulk to desired format.
  • Auto prevents converting a image if it already matches the format.
  • Toggle on saving a folder to default selection to (useful on frequent conversions)

Theres two steps on getting it running: install PIL to your Python and paste my script into your Python terminal. 

Installing PIL:

If you're on Windows like me you can open up command prompt and type in.

pip install pillow

If you're not then I suggest heading over to this page for more info on installing Pillow PIL Fork.


Image Converter Script:

Now for my script, it uses TKinter for a GUI interface. I prefer visual widgets and tools so TKinter was perfect for my needs. 

Paste Script from Here


Demo Video:

Heres a video of using the script. I'm running Python inside Visual Studio Code as I prefer its syncing capabilities with Unreal Engine. 




Bibliography:

Useful links I used to build the tool and troubleshoot it.

Codecademy (2025). Getting Started with Image Processing in Python using Pillow. [online] Codecademy. Available at: https://www.codecademy.com/article/getting-started-with-image-processing-in-python-using-pillow.

Conyers, B. (2012). How to select a directory and store the location using tkinter in Python. [online] Stack Overflow. Available at: https://stackoverflow.com/questions/11295917/how-to-select-a-directory-and-store-the-location-using-tkinter-in-python.

GeeksforGeeks (2020). File Explorer in Python using Tkinter. [online] GeeksforGeeks. Available at: https://www.geeksforgeeks.org/python/file-explorer-in-python-using-tkinter/ [Accessed 12 Jul. 2025].

GeeksforGeeks (2021). Get Last N characters of a string Python. [online] GeeksforGeeks. Available at: https://www.geeksforgeeks.org/python/python-get-last-n-characters-of-a-string/ [Accessed 12 Jul. 2025].

TKDocs (2024). TkDocs Tutorial - Basic Widgets. [online] Tkdocs.com. Available at: https://tkdocs.com/tutorial/widgets.html#checkbutton [Accessed 12 Jul. 2025].

TKinter, J.W.L. updated T.G. started with (2022). Grid Layout Manager in Tkinter. [online] Python GUIs. Available at: https://www.pythonguis.com/tutorials/create-ui-with-tkinter-grid-layout-manager/.

TutorialPoint (n.d.). Python - Tkinter Checkbutton - Tutorialspoint. [online] www.tutorialspoint.com. Available at: https://www.tutorialspoint.com/python/tk_checkbutton.htm.

Ulhaq, M. (2012). How do I check if a directory exists in Python? [online] Stack Overflow. Available at: https://stackoverflow.com/questions/8933237/how-do-i-check-if-a-directory-exists-in-python.

Verma, A. (2019). Image Conversion (JPG ⇄ PNG/JPG ⇄ WEBP) with Python. [online] Medium. Available at: https://medium.com/@ajeet214/image-type-conversion-jpg-png-jpg-webp-png-webp-with-python-7d5df09394c9 [Accessed 12 Jul. 2025].

W3Schools (n.d.). Python - Global Variables. [online] www.w3schools.com. Available at: https://www.w3schools.com/python/python_variables_global.asp.