| <<<Back 1 day (to 2022/07/07) | Fwd 1 day (to 2022/07/09) >>> | 20220708 |
artifexirc-bot | <xx> I have a pdf that's a single page and want to convert it to a jpg of a specific size. Using imagemagick, I can do `convert -density 300x300 -units PixelsPerInch -resize 2480x3507! -quality 75 -alpha remove input.pdf output.jpg` what would be the equivalent in ghostscript? `gs -sDEVICE=jpeggray -dJPEGQ=75 -r300 -o output.jpg input.pdf` gets close to 2480x3507 by default, but not exactly. | 20:48.25 |
| <xx> (the input.pdf is A4 page size) | 20:48.58 |
| <xx> I think it may be the -g flag | 20:54.16 |
| <xx> I get strange interaction between `-dDownScaleFactor=4 -r1200 -g2480x3507`, it produces an image that only has top-left part of the pdf and is 620x876 pixels | 21:43.39 |
| <xx> (I'm trying to get some antialiasing on the output, and was told that dDownScaleFactor is preferable to d*AlphaBits) | 21:44.34 |
| <xx> based on reading some internet results, it looks like this is one of the cases where dDownScaleFactor will not work as I'd think and instead I have to use the d*AlphaBits | 22:20.45 |
| <Robin_Watts> What size were you expecting to get out? | 23:17.03 |
| <Robin_Watts> Sorry. I should read stuff. | 23:17.28 |
| <xx> I'm happy to provide any further details | 23:18.03 |
| <Robin_Watts> If you're wanting to get a 2480x3507 bitmap out, and you're using -dDownScaleFactor=4 then you need to -g with 2480*4 and 3507*4. | 23:18.24 |
| <xx> oh is that how it works? I'll test that | 23:18.39 |
| <Robin_Watts> If you're wanting to get a 2480x3507 bitmap out, and you're using -dDownScaleFactor=4 then you need to -g with `2480*4` and `3507*4`. | 23:18.57 |
| <xx> that indeed works, thanks | 23:48.00 |
| <xx> `factor=4; gs -sDEVICE=jpeggray -dJPEGQ=75 -dDownScaleFactor="$factor" -r"$((300*factor))" -g"$((2480*factor))"x"$((3507*factor))" -o "gs${factor}.jpg" file.pdf` | 23:48.41 |
| <<<Back 1 day (to 2022/07/07) | Forward 1 day (to 2022/07/09)>>> | |