Skip to content

manjeet-thadani/Python-Compress-Image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Compress Image

While working on application performance tuning for some part time work I needed to find a way to compress 100,000+ images. I wrote a pythons script (attached below) to compress the files for this specific task. Here’s my version of the image compression script built for compressing images in a given directory to a managebale size using Pil (or Pillow) a python library that does most of the work here.

Installation

Dependencies

Install PIL or Pillow

    pip install Pillow

Usage

  1. Download above python script.

  2. Create directory named "input" in same directory where above python code it present.

  3. Put All your images that has to be compressed inside "input" directory

  4. All compressed images will be stored in directory named "output"

  5. Select quality level for output images

		foo.save(out_path, optimize=True, quality=<your desired quality level>)
  1. Run script
		python image_compress.py

About

Compress or Optimise Images Using Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages