There are many times I get single page PDFs that I want to convert to JPEGs and crop the excess whitespace off of.
Here is the current set of commands I have which accomplishes what I want:
gm convert -density 300 -trim INPUT.PDF TMP.PNG
gm convert -bordercolor white -border 10 TMP.PNG OUTPUT.JPG
rm TMP.PNG
I am trying to figure out how to condense these commands into a single command, and avoid creating the temporary TMP.PNG for processing.
This is my current attempt at consolidating the above commands:
gm convert INPUT.PDF -density 300 -trim -bordercolor white -border 10 OUTPUT.JPG
The problem I have with this command is that it generates a very blurry JPEG. Below, the first image (on the left) is a sample of the undesired result generated by my single-command attempt. The second image (on the right) is a sample of the crisp, high-quality result I am looking for that I currently have to use multiple commands to achieve. What is the correct way to consolidate the commands at the beginning of my post?