Both these commands work fine for me on IM 6.9.9.0 Q16 Mac OSX.
Code: Select all
for pic in /Users/fred/desktop/test/*.jpg; do
echo $pic
convert $pic -resize 2000x2000^ $pic
echo "resize done"
convert -verbose $pic -units PixelsPerInch -resample 300 $pic
done
Code: Select all
for pic in /Users/fred/desktop/test/*.jpg; do
echo $pic
convert $pic -resize 2000x2000^ -verbose -units PixelsPerInch -resample 300 $pic
echo "done"
done
Except that the -resample did nothing. See below regarding your input files having no units or density specified.
Have you tried just copying and pasting the code into a terminal window rather than calling it as a script?
What dimensions are your input images?
Do you really want to resample the images or do you just want to have the resized results assigned 300 dpi. If the latter then just do
Code: Select all
convert $pic -resize 2000x2000^ -units PixelsPerInch -density 300 $pic
Another possible issue is that your input images have no units define and possibly no density or density=1. That may cause an issue on your version of IM. You can check by identify -verbose input.jpg. So the proper way to do your command would be to make sure you have assigned a density and units to your input images or the results of your resized images. Nominal density is 72. But if your input files have no units, then the density that it might have is useless or possibly it gets assigned a density of 1.
Code: Select all
for pic in /Users/fred/desktop/test/*.jpg; do
echo $pic
convert $pic -resize 2000x2000^ -units PixelsPerInch -density 72 $pic
echo "resize done"
convert -verbose $pic -units PixelsPerInch -resample 300 $pic
done
Now the -resample makes the output images much larger and cases the script to run much slower. Output sizes are >10,000 due to going from 72 dpi to 300 dpi. That is why I asked if you really wanted the resample and not just setting the output density.