Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I was wondering how to convert an image from grayscale to binary. The image is a pdf format of one-page document.

Also by using imagemagick's "convert 1.pdf 1.eps" to convert it to eps or other formats such as tif, I found the image become more or less vague. How can I preserve the clearness of the image?

Thanks!


Update:

Here is the link to the file http://www.mediafire.com/download.php?y7q8l2pyqlukld3

Thanks!

share|improve this question
    
Is this a raster image or a vector image? –  JanC Oct 28 '10 at 0:33
    
It is a pdf of scanned one-page document. I am not sure if it is a raster or a vector image. Do you know about that? –  Tim Oct 28 '10 at 0:36
    
@JanC: I just uploaded the file. Check this link mediafire.com/download.php?y7q8l2pyqlukld3 –  Tim Oct 28 '10 at 0:40
    
The link seems to be broken, are you still having the problem? –  Mateo Jun 5 '12 at 21:37
    
@mateo: Sorry, I don't have the images anymore. I think I couldn't figure out the solution and then gave it up. –  Tim Jun 5 '12 at 21:40

2 Answers 2

Hm, it seems like that image is stored into the PDF as a bunch of long small "strips" of the complete image. It also seems like there is a filter or set of filters applied in the PDF that makes the image to be shown as b/w instead of the graylevels that it really is. You can open it in Inkscape, for example, to see some of this for yourself, as it seems like these filters aren't imported (I guess the same happened when you converted to PS or TIFF).

Turning it from a grayscale to a bitmap will probably require a bit of playing with contrast & such to get an optimal result (the scan isn't very hi-res to start with...).

You can import the PDF into The GIMP and play with various filters and colour-options, or maybe use similar functions in imagemagick to create a bitmap version. It's difficult what filter/setting will give the best results...

share|improve this answer

Open in the gimp, import pdf at 300dpi, go image > mode > indexed, and select 1 bit (black/white), save as tiff with no compression. Once you have a tiff that is essentially the image as a raster format in binary, and you can open in a raster processing program / image library of your favourite language or convert it to an ascii grid using gdal_translate

I'm fairly sure with imagemagick if you specify -density 300 it'll be the same effect as using gimp at 300dpi if you needed to do batch conversions. Your eps/pdf viewer is rasterising the vector source to your displays resolution at its zoom level, i.e. at 200% on a 75dpi screen the effective dpi for a rasterisation that your viewer is doing is 150 and so on, so pick the zoomlevel you want the image to look clear at for processing etc and then set your conversion tools dpi accordingly.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.