oops, forgot k++; in that for loop.
-R
On Tue, Nov 25, 2008 at 1:02 PM, Rick Carback <[EMAIL PROTECTED]> wrote:
> Klas,
>
> You should be able to read the bytes and convert them.
>
> Something like this should work (written on the fly, there might be
> mistakes):
>
> Image i = ...
> byte[] b = i.getRawData();
> byte[] grayscale = new byte[b.length%3];
> int k = 0;
> for (int j = 0; j < b.length; j+=3) {
> //Y = 0.3*R + 0.59*G + 0.11*B
> grayscale[k] = (byte)(.3*b[j]+.56*b[j+1]+.11*b[j+2]);
> }
> Image grayscaleImage = Image.getInstance(i.getWidth(), i.getHeight(), 1, 8,
> grayscale);
>
> ....
>
> -R
>
>
> On Tue, Nov 25, 2008 at 7:24 AM, Klas Lindbäck <[EMAIL PROTECTED]>wrote:
>
>> There has been no reply to my question 5 days ago on converting a PDF
>> containing an image with RGB color
>> to grayscale. Am I correct to assume that there is no easy way to do
>> this using iText?
>>
>> Cheers,
>> Klas
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> iText-questions mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> Buy the iText book: http://www.1t3xt.com/docs/book.php
>>
>
>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php