Skip to content

HeardLibrary/tiff-jpeg-conversion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

tiff-jpeg-conversion

Python Script to recursively convert TIFF files to JPEF at 300DPI (Same setting which was being used earlier)

TIFF to JPEG S3 Converter

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.


What It Does

  • 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-DD inside a destination bucket/prefix of your choice
  • Runs parallel conversions (10 at a time)

Requirements

  • Python 3.x
  • AWS credentials configured on your machine (aws configure)
  • Python library:
pip install boto3 pillow

Usage

  1. Download the script and place it anywhere on your machine.
  2. Open your terminal and navigate to where the script is saved:
cd path/to/script
  1. Run it:
python tiff_to_jpeg.py
  1. 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 `/`.
---

About

Python Script to recursively convert TIFF files to JPEF at 300DPI (Same setting which was being used earlier)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages