Last active
August 29, 2015 14:22
-
-
Save kvz/a9e2cabd617636db0055 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Transloadit API2. Copyright (c) 2015, Transloadit Ltd. | |
# | |
# This file | |
# - Reproduces the issue where resizing a certain jpg breaks | |
# the image on OSX & iOS, wheras the original dispays fine. | |
# | |
# Reported first by Richard Taylor in http://support.transloadit.com/discussions/questions/96479-image-conversion-problem | |
# | |
# Typically called as `./debug.sh [target.jpg]` | |
# | |
# Authors: | |
# - Kevin van Zonneveld <[email protected]> | |
set -o pipefail | |
set -o errexit | |
set -o nounset | |
# set -o xtrace | |
# Set magic variables for current FILE & DIR | |
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")" | |
__base="$(basename ${__file} .sh)" | |
__root="$(cd "$(dirname "${__dir}")" && pwd)" | |
converVersion="$(convert -version |awk '{print $3}' |head -n1)" | |
target="${1:-$converVersion}" | |
ext="jpg" | |
inFile="${__dir}/orig.${ext}" | |
outFile="${__dir}/${target}.${ext}" | |
if [ ! -f "${inFile}" ]; then | |
wget "https://www.dropbox.com/s/rd4p6x1f5sx93jd/orig.jpg?dl=1" -O "${inFile}" | |
fi | |
rm -f "${outFile}" | |
convert \ | |
"${inFile}" \ | |
"${outFile}" | |
echo "" | |
echo "${inFile}" | |
echo exiftool: $(exiftool "${inFile}" |egrep -i '(width|height)' || true) | |
echo sips: $(sips -g pixelWidth -g pixelHeight "${inFile}" |egrep -i '(width|height)' || true) | |
echo "" | |
echo "${outFile}" | |
echo exiftool: $(exiftool "${outFile}" |egrep -i '(width|height)' || true) | |
echo sips: $(sips -g pixelWidth -g pixelHeight "${outFile}" |egrep -i '(width|height)' || true) | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment