Turn PDF into grayscale
Sundar Nagarajan
sundar.personal at gmail.com
Mon Jun 26 23:23:11 UTC 2006
Dariusz J. Garbowski wrote:
> On 06/26/2006 11:11 PM, Sundar Nagarajan wrote:
>> Pupeno wrote:
>>> Hello,
>>> I have some color PDFs I'd like to turn into grayscale, any ideas how ?
>>> I have tried printing to PDF (the pdf itself) and setting it to
>>> grayscale, but the PDF ends up in color anyway.
>>> Thank you.
>>>
>>
>> You can do this quite simply at the command line using the Imagemagick
>> tools. Install imagemagick ('apt-get install imagemagick' should do
>> the trick).
>>
>> to convert a file named color.pdf to grayscale and store the output in
>> a file named gray.pdf:
>>
>> convert -colorspace GRAY color.pdf gray.pdf
>>
>> The only drawback I see is that this always seems to choose a gray
>> colorspace with 256 colors (while the original colorspace may have
>> (e.g.) 64K colors. Maybe someone else can comment whether the GRAY
>> colorspace is always 8-bit.
>
> This is simple: gray colour is made of all three RGB channels having the
> same value. Thus you have:
>
> R G B shade of gray
> 0 0 0 black
> 1 1 1 almost black
> 2 2 2 almost black
> ...
> 127 127 127 gray
> 128 128 128 a bit lighter gray
> ...
> 255 255 255 white
>
> what makes 256 colour space (or "gray space" ;-) This can only improve
> if you have more bits-per-channel. Notice that 24 bit colour jpg is only
> 8 bit per channel (3 channels * 8 bit = 24 bit).
>
> Regards,
> Dariusz
Ahh.. that is a good explanation.. I should have done a little more
thinking myself :-(
So the color reduction algorithm maps an RGB color to the "nearest" RGB
subset having the same values for R, G and B? Then that single identical
value is the "gray color"?
More information about the kubuntu-users
mailing list