This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
cs:pdf_to_pictures [2019/02/11 14:40] paolo_bolzoni Add a note to keep convert memory usage under control |
cs:pdf_to_pictures [2019/02/11 16:30] (current) paolo_bolzoni Trim paper horizontally |
||
---|---|---|---|
Line 29: | Line 29: | ||
$ img2pdf --pagesize a4 --border 0 --output easy2print_output.pdf soutput-*png | $ img2pdf --pagesize a4 --border 0 --output easy2print_output.pdf soutput-*png | ||
+ | |||
+ | |||
+ | ====== Excessive memory usage ====== | ||
It is possible to use greater resolutions to print for example with 600DPI, just use ''-r2400''. But the ''convert'' step may require too much memory to resize the output ''.png'' files. It is the case, it is possible to limit the amount of memory using environment variables: | It is possible to use greater resolutions to print for example with 600DPI, just use ''-r2400''. But the ''convert'' step may require too much memory to resize the output ''.png'' files. It is the case, it is possible to limit the amount of memory using environment variables: | ||
Line 37: | Line 40: | ||
| | ||
Here is [[https://www.imagemagick.org/script/resources.php#environment|the list of environment variables that ImageMagick understands]]. | Here is [[https://www.imagemagick.org/script/resources.php#environment|the list of environment variables that ImageMagick understands]]. | ||
+ | |||
+ | |||
+ | ====== Change paper size ====== | ||
+ | |||
+ | ''img2pdf'' creates a ''.pdf'' file with the requested page size. But if the original ''.pdf'' was in another format the pages might have weird borders as the result will be squeezed, but not deformed. To print a letter size ''.pdf'' in A4 for example will result in very tall top and bottom borders; this happens because the letter paper size is wider and shorter, when squeezed in the A4 the horizontal borders will be almost the same (because the picture is just a bit smaller), but the vertical ones will be much taller. | ||
+ | |||
+ | It is worth a try to trim the pictures to have the new paper size. To do so you need to know the correct size of the picture and ''convert''. For example, if you want to print 300DPI, the picture size will be the paper size **in inches** times 300. | ||
+ | |||
+ | The command, for a 300DPI A4 will be: | ||
+ | |||
+ | $ convert input.png -gravity Center -crop 2481x3507+0+0 +repage output.png | ||
+ | |||
+ | It is also possible to add ''-gravity Center -crop 2481x3507+0+0 +repage'' directly in Step two just before the output filename. |