How to convert PDF to PNG using DMagick?
Mike Wey
mike-wey at example.com
Sat Sep 25 15:14:50 UTC 2021
On 25-09-2021 15:21, tastyminerals wrote:
> When I need to convert a PDF image in console, I use ImageMagick:
> `convert doc.pdf doc.png` command. Today I found ImageMagick D bindings
> -- DMagick https://github.com/MikeWey/DMagick. I would like to script
> this operation using DMagick. However, I couldn't find any code samples
> and was not able to find anything about image conversion in official
> ImageMagick C API docs either (maybe I need to spend more time though).
> But maybe someone has code samples of how to convert PDF?
It's been awhile since i used it myself, but if imagemagick supports
reading PDF's this might work:
```
Image pdf = new Image("./test.pdf")
pdf.write("./test.png")
```
DMagick hasn't been updated in a while so it will probably not work with
newer versions of ImageMagick.
--
Mike Wey
More information about the Digitalmars-d-learn
mailing list