gravity
parameter here isn't effective appropriately
(unable to align the object)
as it can't recognize the position & resolution of A4
page at 300 dpi
. This is why the questioned command is outputting blank pages at 300 dpi
.
We should avoid using page
parameter if density is already defined. ImageMagick has a parameter
called extent
that can be used to define the resolution of a page at a given density (here 300 dpi
). Thus we should use extent
instead of page
in this case in order to achieve the desired output.
For example,
resolution of A4 size page at 300 dpi is 2480x3508, thus correct command for a set density like 300 dpi
shall be:
"convert -units PixelsPerInch -density 300 $myfiles -gravity center -extent 2480x3508 test.pdf"
Here, resolution of extent
parameter should be proportionately equal to the set density
for any specific page size.