You have a CMYK image where 4 consecutive bytes form a pixel. That's not an image format just pixels that you must arrange in some other way to create an image like tiff or png (for png you'll have to convert from CMYK to RGB) or something else.

Paulo

----- Original Message ----- From: "Petter Nyström" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, March 07, 2006 7:07 PM
Subject: Re: [iText-questions] Can iText replace images etc.


On Mon, 6 Mar 2006, bruno wrote:

Forgive me for not answering all the questions at once.
Let's do this step by step. First download the iText Toolbox:
http://www.lowagie.com/iText/itext.jnlp

[...]

That was a neat example. Thanks! It helped me a lot in penetrating the
outer defences of iText. So I have now reached a little bit inside and I
think I know how to grab the byte stream of an image. I am using the
following snippet in the last step to get the bytes:

    public void writeImage (PRStream image)
    {
        byte[] imageStream = PdfReader.getStreamBytes(image);
        ...

I hope this is correct. Writing these bytes to a file will however not
produce anything useful. None of my image viewing program will understand
it. Neither would ppmtojpeg or a host of other conversion programs that
I've tried at it. :p

So there I am. Reading the dictionary of the PRStream I learn that the
colorspace is of the type /DeviceCMYK. And while I think I have a (very)
basic understanding of what that means, I am far from ready to manipulate
the byte stream into a recognizable image format myself!

I feel I am moving outside the scope of iText here... But could someone
give any pointers to what tools that exist, both within and outside iText,
for dealing with a byte stream of this type? I want this stream turned
into some sort of standard image format to work with.

This is what the full dictionary of my typical PRStream look like, if it
is of any help:

[/Filter : /FlateDecode, /Type : /XObject, /Length : 402990,
/BitsPerComponent : 8, /Height : 353, /ColorSpace : /DeviceCMYK,
/Subtype : /Image, /Intent : /RelativeColorimetric, /Width : 370]

Are there other troubles I should watch out for? Such as byte streams
being encrypted, compressed, etc.?

Regards,

Petter Nyström

P.S. And yes, I have been reading up on the chapters 3 and 4.8 of the PDF
Reference - but I don't know them by heart quite yet! =) D.S.


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to