Page 1 of 1

load a PDF without antialiasing

Posted: 2016-07-22T05:02:09-07:00
by 19xxandrea
Hi,

I need convert a PDF into an image for my app developed in C++.
I have no trouble to convert the PDF into the image but I need also to turn-off the antialias.

It is possible?

Here my simple code:

int main( int argc, char ** argv)
{
InitializeMagick(*argv);

Image * img = new Image();

img->density("100");
img->strokeAntiAlias(false); //This is wrong! It doesn't work!
img->read("input.pdf");
img->write("output.bmp");

return 0;
}

Thanks

Re: load a PDF without antialiasing

Posted: 2016-07-22T05:42:14-07:00
by snibgo
IM delegates the rasterising of PDFs to Ghostscript. "-verbose" shows it gives the same command to GS regardless of the antialias setting.

I don't know if GS has an option for turning off anti-aliasing. If it does, you could ask for that feature to be added to IM, and for a workaround you could change delegates.xml.

Re: load a PDF without antialiasing

Posted: 2016-07-22T06:10:54-07:00
by 19xxandrea
Probably GS has the option that I need. Because if I run:

convert -density 100 -background white -flatten +antialias input.pdf output.bmp

it works fine. Exactly what I need.

But I can't reproduce this in my c++ code.

Thanks

Re: load a PDF without antialiasing

Posted: 2016-07-22T06:43:01-07:00
by snibgo
Oh, good. Why are you using strokeAntiAlias? The doc http://www.imagemagick.org/Magick++/Image++.html says this is for "drawing object outlines". For "antialiasing of rendered Postscript and Postscript or TrueType fonts", the doc says this is antiAlias.

Re: load a PDF without antialiasing

Posted: 2016-07-22T07:18:45-07:00
by 19xxandrea
also:

Code: Select all

img->antiAlias(false);
does't work in my case... :(

Re: load a PDF without antialiasing

Posted: 2016-07-25T05:06:34-07:00
by 19xxandrea
Hi,

I have not yet found a solution. Could be my problem a small bug of the library?

Thanks