Python Automation and Machine Learning for EM and ICs

An Online Book, Second Edition by Dr. Yougui Liao (2019)

Python Automation and Machine Learning for EM and ICs - An Online Book

Chapter/Index: Introduction | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | Appendix

Convert images between formats (e.g. jpg, png, tif)

This Python script (Code) processes all .jpg images in a specified folder, resizing them to a thumbnail size of 512x512 pixels. It first prompts the user to input the path to the image folder. The script then iterates through all .jpg files in the directory, opening each image, resizing it, and saving it in TIFF format using the same base file name. The image conversion is handled using the PIL (Python Imaging Library) module, with the thumbnail method ensuring that the image retains its aspect ratio while being resized.

This script (Code) is a modified script that converts all image formats to .tif and saves the images in the same folder with the same size as the original images.