Optimize any image using techniques like chroma subsampling and optimized huffman coding etc.
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.
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
.
Make sure you have the following is installed:
Give image path by command line argument.
python optimizer.py IMAGE_PATH
Give relative image path inplace of IMAGE_PATH
- Before size : 135 KB. Resolution : 1200 x 675
after size : 119 KB. Resolution : 1200 x 675
Resolution is still same. But size is decresed.
- Before size : 3358 KB. Resolution : 4208 x 2368
after size : 960 KB. Resolution : 4208 x 2368
Resolution is still same. But size is decresed by ~70%
- Before size : 1482 KB. Resolution : 2592 x 1458
after size : 396 KB. Resolution : 2592 x 1458
Resolution is still same. But size is decresed by ~70%
- Before size : 566 KB. Resolution : 2000 x 1125
after size : 331 KB. Resolution : 2000 x 1125
Resolution is still same. But size is decresed.
Average time for optimizing a 1280 x 720 image is around 2 minutes. That is very long.
I will try to reduce that time.