Page 1 of 1

Text antialiasing, poor file conversion

Posted: 2010-02-04T10:46:46-07:00
by youds
Hi

I'm trying to convert a high res PDF file to JPG file, and am noticing that there is no text anti aliasing. See link below.
http://www.imagemagick.org/script/comma ... #antialias

When I run "convert file.pdf file.jpg" and "convert -antialias file.pdf file.jpg" there is no difference between the two files.
Files can be seen in the "imagick" folder here: http://public.me.com/craigfairhurst

How do you turn antialias'ing on? Use a blur perhaps? The text quality is visibly poor in the resulting file, see "imagick" folder above.

Re: Text antialiasing, poor file conversion

Posted: 2010-02-04T10:50:45-07:00
by fmw42
use supersampling

convert -density 288 image.pdf -resize 25% image.jpg

density 288=4*72 where 72 is nominal density so resize down by 1/4=25%

Re: Text antialiasing, poor file conversion

Posted: 2010-02-04T10:52:10-07:00
by youds
Excellent, thanks.

Re: Text antialiasing, poor file conversion

Posted: 2010-05-07T09:09:06-07:00
by youds
Hi

Could do with revisiting this. I've been working with this project since the start of the year and have progressed quite a way with converting between postscript-type files, namely PDFs.
I've already deployed a solution with ImageMagick that outputs JPG's in high quality format from PDF's.
I've noticed however that there are significant differences in the rendering of text compared to images. Images render fine, texts degrade much quicker at lower densities.

I'm aware that the rasterization takes place which is where the problem fundamentally lies, however is there anything more that can be done to make it more smooth for text when being processed? I've noticed particularly at lower densities eg. 92 the text is worse than the images.

Any help would be appreciated.

Re: Text antialiasing, poor file conversion

Posted: 2010-05-07T12:40:56-07:00
by Drarakel
I don't think that there is an alternative to the supersampling method.
Ghostscript makes the rasterization. You can change the handling of the elements that are antialiased. But some things are simply not antialiased at all with Ghostscript. (I think that normal fonts are antialiased. But other vector graphics are not - or not always?)

Re: Text antialiasing, poor file conversion

Posted: 2010-05-10T00:58:19-07:00
by youds
Possibly yes. I've been looking for an alternative to manage the vector files and haven't come across anything suitable, GIMP on the command line was all that I came across.

Re: Text antialiasing, poor file conversion

Posted: 2010-05-10T07:59:36-07:00
by Drarakel
But what hinders you from using the supersampling method? I think the only disadvantages are an increased processing time - and a bit of blurriness (if the upsampling/downsampling size is not ideal). But the jagged edges of the text will be gone.
If you have problems with specific PDFs, you could upload an example..

Re: Text antialiasing, poor file conversion

Posted: 2010-05-10T08:21:20-07:00
by youds
Filesize, mainly. Rasterization is an issue however not at low density due to PDFs being for email delivery.
See http://public.me.com/craigfairhurst (the enclosed ZIP file)

Re: Text antialiasing, poor file conversion

Posted: 2010-05-10T12:27:28-07:00
by Drarakel
The filesize should stay about the same with supersampling.
Anyway, this method is mainly for vectorial elements that can be rasterized at a higher density and then get downsized (and the downsizing does some sort of antialiasing).

But this last PDF is solely made out of images (already rasterized, stored with a simple RLE compression) - with no (vectorial) text at all. The best thing you can do with such a PDF is to just 'rasterize' it again with the source density (105dpi in your case). You could probably test some things to reduce the jagged edges (blurring or something like that), but personally, I would stay with the unmodified source images. If you resize the 105dpi images to a lower resolution, the jagginess will also be a bit reduced of course.
Example - the 5th page at 105dpi:
http://i41.tinypic.com/5bol0.png
Then resampled to 72dpi:
http://i39.tinypic.com/29gbbf6.png
IMO, there's no automatic way to rasterize various PDFs - at least if you always want a 'perfect' result. :wink: