I'm running convert from a shellexecute in an outlook vba to handle bulk attachments.
When they arrive the vba saves the attached TIF or PDF and then runs convert to separate the pages into sequentially numbered TIF's
However if someone sends a single page the resulting filename is File_Name_%02d.tif instead of just File_Name.tif or even File_Name_00.tif
Does anyone know of a way to prevent it from adding the suffix if it's only a single page?
convert tif - prevent renaming on single page
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: convert tif - prevent renaming on single page
write a script to test the number of frames and use a conditional to write the filename in two different ways depending upon if there are more than one frame.
see http://www.imagemagick.org/script/escape.php %n for number of scenes
convert rose: rose: rose: rose3.tif
scenes=`convert rose3.tif -format %n info: | head -n 1`
if [ $scenes -eq 1 ]; then
#write name for one scene
else
#write name for multple scenes
fi
In this case you will get scenes=3
Windows uses should see the equivalent concepts in http://www.imagemagick.org/Usage/windows/
see http://www.imagemagick.org/script/escape.php %n for number of scenes
convert rose: rose: rose: rose3.tif
scenes=`convert rose3.tif -format %n info: | head -n 1`
if [ $scenes -eq 1 ]; then
#write name for one scene
else
#write name for multple scenes
fi
In this case you will get scenes=3
Windows uses should see the equivalent concepts in http://www.imagemagick.org/Usage/windows/