Python Script to recursively convert TIFF files to JPEF at 300DPI (Same setting which was being used earlier)
A Python script that recursively finds all TIFF files in an S3 bucket (across all nested folders), converts them to JPEG at 300 DPI, and dumps them into a flat output folder in a destination S3 bucket.
- Scans an entire S3 bucket or a specific prefix/path — recursively through all nested subfolders
- Converts every TIFF found to JPEG at 300 DPI (preserving the DPI logic from the original scripts)
- Outputs all JPEGs into a folder named
JPEG_YYYY-MM-DDinside a destination bucket/prefix of your choice - Runs parallel conversions (10 at a time)
- Python 3.x
- AWS credentials configured on your machine (
aws configure) - Python library:
pip install boto3 pillow- Download the script and place it anywhere on your machine.
- Open your terminal and navigate to where the script is saved:
cd path/to/script- Run it:
python tiff_to_jpeg.py- Answer the prompts:
TIFF → JPEG Converter
Enter source bucket name (where TIFFs are): ltp-scua
Enter source prefix/path (e.g. spc/mss0455/) or leave blank for entire bucket: spc/mss0455/
Enter destination bucket name (where JPEGs should go): ltp-scua-test
Enter destination prefix/path (e.g. spc/mss0455/) or leave blank for root of bucket: spc/mss0455/
Source : s3://ltp-scua/spc/mss0455/
Destination : s3://ltp-scua-test/spc/mss0455/JPEG_2026-05-15/
DPI : 300 | Quality: 95
---
Prompt Options
Will get a prompt option to enter bucket name plus also some prefix (incase we need to convert only for specific subfolder on some prefix. But, it should end with root '/' )
---
Output Folder Naming
The output folder is automatically named `JPEG_YYYY-MM-DD` based on the date you run the script. For example:
s3://ltp-scua-test/spc/mss0455/JPEG_2026-05-15/ spc-mss0455-s01-g0001_0001.jpg spc-mss0455-s01-g0001_0002.jpg spc-mss0455-s01-g0001_0003.jpg ...
All JPEGs land in this single flat folder regardless of how deeply nested the source TIFFs were.
---
These settings match the existing `tiff_to_jpeg_300dpi.py` script available in github currently being used.
---
##TroubleShooting
`NoSuchBucket` error:
Double-check the bucket name
No TIFFs found:
Check that your source prefix is correct. Prefixes are case-sensitive and should not start with `/`.
---