Skip to content

Instantly share code, notes, and snippets.

@yu81
Created December 30, 2018 17:46
Show Gist options
  • Save yu81/5ecebad58e7f40825ae5f6c1f9f57244 to your computer and use it in GitHub Desktop.
Save yu81/5ecebad58e7f40825ae5f6c1f9f57244 to your computer and use it in GitHub Desktop.
# :eyes: https://github.com/tgagor/docker-jpegtran
function jpegtran_docker {
[ $(docker images jpegtran | wc -l) != 2 ] && return 1 # ahead of this, build jpegtran with https://github.com/tgagor/docker-jpegtran.git
local file=$1
[ -z $file ] && return 1
local filedir=$(dirname ${file})
[ ${filedir} = "." ] && filedir=$(pwd)
local f=$(basename ${file})
local mount_volumes=${filedir}:/tmp
docker run -v ${mount_volumes} jpegtran jpegtran -copy all -debug -optimize -outfile "/tmp/${f}" "/tmp/${f}"
return $?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment