Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
All I need to do is scale a (quite large) TIFF. It completes, but when I try to view it, it fails. I can successfully scale and convert to JPEG, but no luck to TIFF from TIFF or to TIFF from JPEG. Any help would be appreciated. Here's my output:
Ah, nothing on there really worked for me, so I wrote up a script! I was having problems with some of the converted images having a black bar through them near the end and figured it was because multiple instances were running, so I added a lock file system so they'd only run one at a time. Well, it still happened. Finally figured out that /var/tmp was running out of space so changed that around too. Whaddya know, it works great now and is actually running a bit faster! Here's my script in case anyone's interested.
#!/usr/compat/linux/bin/bash
srcdir=`echo "$1" | sed 's/[a-zA-Z0-9\.\-\ \#]*\.tif$//'`
dstdir=`echo "$2" | sed 's/[a-zA-Z0-9\.\-\ \#]*\.tif$//'`
tmpdst=`echo "$2" | sed 's/.tif/.gif/'`
lockfile="/usr/home/xxx/xxx/lockfiles/lock"
export MAGICK_TMPDIR="/usr/home/xxx/xxx/imagemagicktmp"
if [ -d "$srcdir" ]; then
echo "Directory $srcdir exists"
else
echo "Directory $srcdir does not exist. Exiting"
exit 1
fi
if [ -e "$1" ]; then
echo "File $1 exists"
else
echo "File $1 does not exist. Exiting"
exit 1
fi
if [ -d "$dstdir" ]; then
echo "Directory $dstdir exists"
else
echo "Directory $dstdir does not exist, creating"
`mkdir -p $dstdir`
fi
while [ -e $lockfile ]
do
sleep 4
done
echo "Input is $1, output is $2. Medium is $tmpdst"
`touch $lockfile && /usr/local/bin/convert -monitor -verbose +dither -scale 800x600 "$1" "$tmpdst"`
if [ "$3" -ge 0 ]; then
`/usr/local/bin/mogrify -rotate $3 "$tmpdst"`
fi
`/usr/local/bin/convert +compress "$tmpdst" "$2"`
`rm "$tmpdst"`
`rm $lockfile
This is invoked from a PHP frontend. I know it's not best practice to export the tmpdir every time, but due to the server's instability it's a lot safer at this point. Plus not really any error checking... should probably fix that soon. Many thanks to ImageMagick for making what would have taken weeks to code possible to do with a couple days of experimentation!