Progressive/interlacd jpeg on Linux

 

How to install jpegtran

apt-get install libjpeg-progs

 

Script found here

#!/usr/bin/env bash
function optimize
{
echo $1
filesize=`stat –format=%s "$1"`
if [[ $filesize -lt 10000 ]]; then
jpegtran -copy none -optimize "$1" > "$1.bak"
echo "pet"
else
jpegtran -copy none -progressive "$1" > "$1.bak"
echo "grand"
fi
if [[ $filesize -lt `stat –format=%s "$1.bak"` ]]; then
echo "compression plus lourde"
rm "$1.bak"
else
echo "good!"
mv "$1.bak" "$1"
fi
}
find . -name '*.jpg' -type f -print0 |while read -d $'\0' i; do optimize "$i"; done

#!/usr/bin/env bash

function optimize
{
echo $1
filesize=`stat –format=%s “$1″`
if [[ $filesize -lt 10000 ]]; then
jpegtran -copy none -optimize “$1” > “$1.bak”
echo “pet”
else
jpegtran -copy none -progressive “$1” > “$1.bak”
echo “grand”
fi

if [[ $filesize -lt `stat –format=%s “$1.bak”` ]]; then
echo “compression plus lourde”
rm “$1.bak”
else
echo “good!”
mv “$1.bak” “$1”
fi
}
find . -name ‘*.jpg’ -type f -print0 |while read -d $’\0′ i; do optimize “$i”; done

Or you can use also image magic

find . -name ‘*.jpg’ -exec convert -strip -interlace Plane -quality 80 {} {} \;

Check if it is interlaced

find . -name ‘*.jpg’ | xargs identify -verbose *.jpg | grep Interlace

Mount your bucket with s3fs

 

s3fs -o use_cache=/tmp/cache mybucket /mnt/s3

 

how to install

https://www.robusta-hosting.eu/en/blog/development/2015/04/install-s3fs-ubuntu-1404-lts