I'm converting a bunch of pdf vector figures to png files.
for f in *.pdf
do convert -trim ${f} "${f}.png"
done
rename 's/\.pdf//' *.png
But the dimension of the pictures are too small.
The doc of convert
tells a -size width height
option but I cannot specify a unique size for all pictures. Any other ways?
Best Answer
Use the
-density
option to define how many pixels you want per inch; the default is-density 72
.Also, since you're using Bash, you can directly manipulate the file name in the loop:
without having to do a post-rename.
${src%.*}
in Bash evaluates to the contents ofsrc
, but with everything following a final.
removed. (Ifsrc
does not contain.
,${src%.*}
evaluates to the same as$src
.)