Skip to content

Optimize any image by chroma subsampling and optimized huffman coding in Python. Basically, using JPEG algorithm!

Notifications You must be signed in to change notification settings

prashant-kikani/image-optimizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image-optimizer

Optimize any image using techniques like chroma subsampling and optimized huffman coding etc.

Introduction

Images we capture today, contains so much extra information that is not needed.
And also our human eye have some limitations.
So, removing what our eyes can't see is the basic idea.
Our eye is high sensitive to 'luma' than 'chroma'. So, according to that, image can be optimized.

Advantage

The biggest advantage is image resolution is not changed during this optimization process.
Means if at first image is of size 1458 x 2592, then after optimization process, image resolution will be same 1458 x 2592.
But image size will be decresed or will remain same (if already optimized).

And also, image format is also kept same. png images will be kept png, jpeg images will be kept jpeg.

Setup

Frameworks and Packages

Make sure you have the following is installed:

Usage

Give image path by command line argument.

python optimizer.py IMAGE_PATH

Give relative image path inplace of IMAGE_PATH

Sample performance

  • Before size : 135 KB. Resolution : 1200 x 675

befimg1


after size : 119 KB. Resolution : 1200 x 675
Resolution is still same. But size is decresed.

befimg1

  • Before size : 3358 KB. Resolution : 4208 x 2368

befimg1


after size : 960 KB. Resolution : 4208 x 2368
Resolution is still same. But size is decresed by ~70%

befimg1

  • Before size : 1482 KB. Resolution : 2592 x 1458

befimg1


after size : 396 KB. Resolution : 2592 x 1458
Resolution is still same. But size is decresed by ~70%

befimg1

  • Before size : 566 KB. Resolution : 2000 x 1125

befimg1


after size : 331 KB. Resolution : 2000 x 1125
Resolution is still same. But size is decresed.

befimg1

Future improvements

Average time for optimizing a 1280 x 720 image is around 2 minutes. That is very long.
I will try to reduce that time.

About

Optimize any image by chroma subsampling and optimized huffman coding in Python. Basically, using JPEG algorithm!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages