How to do Image Compression Under Linux
Effects
3.4M -> 490KB without human notice changes to the picture
Requires
sudo apt -y install imagemagick
Script
from auto_everything.base import Python, Terminal
py = Python()
t = Terminal()
class Tools():
def compress(self, image):
t.run(f"""
convert {image} -sampling-factor 4:2:0 -strip -quality 85 -adaptive-resize 60% -interlace JPEG -colorspace RGB compressed_{image}
""")
py.fire(Tools)
py.make_it_global_runnable(executable_name="Tools")
Use it
Tools compress image.jpg