A customer of ours is trying to convert this jpg: https://www.dropbox.com/s/rd4p6x1f5sx93jd/orig.jpg?dl=1 through our service which relies on imagemagick. When the conversion is done though, the file displays properly on all devices except those running OSX (at least Yosemite) and iOS (at least 8 ).
I wrote a script that can be executed or copy-pasted to reproduce: https://gist.github.com/kvz/a9e2cabd617636db0055:
Code: Select all
#!/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 <kevin@transloadit.com>
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 ""
After executing, it shows that the original file (orig.jpg) has dimensions according to exiftool & OSX's sips:
Code: Select all
/Users/kvz/code/api2/api2/test/regression/orig.jpg
exiftool: Exif Image Width : 1024 Exif Image Height : 768 Image Width : 1024 Image Height : 768
sips: pixelWidth: 1024 pixelHeight: 768
/Users/kvz/code/api2/api2/test/regression/6.9.1-4.jpg
exiftool: Exif Image Width : 1024 Exif Image Height : 768 Image Width : 1024 Image Height : 768
sips: pixelWidth: <nil> pixelHeight: <nil>
I tried these imagemagick versions, executed from both Ubuntu Precise and OSX Yosemite:
- 6.5.1-0
- 6.8.9-7
- 6.9.1-4
All producing the same broken image. I'd love some help here : )
Kind regards,
Kevin