I have many images (*.pdf) that originally do not have margin. The files are in various sizes but usually from 8000×4000 to 20000×14000 px.
I use this command to convert them to jpeg:
for /r %x in (*.pdf) do convert -density 400 -quality 100% “%x” “%x.jpg”
But it produces big margins. Margins take 30% of the image size. So I need to prevent them or to crop them. I tried to look in IM manual to find how to obtain width and height and to substract some value and to add it to -crop. But this his too hard to me, I am tring to solve it about 1,5 hours without result. And I am new to IM. Can somebody tell me how to solve this and remove the margin?
Also I would like to repair name of file from e.g. map.pdf to map.jpg Now it result in map.pdf.jpg
I used this code to crop the image after conversion to raster: