Hi Ben,

   I've added the ability to read and write Png's text chunks (tEXt,
zTXt, iTXt) in a controlled way.  I've added a unit test that
demonstrates how to use this new feature:

https://svn.apache.org/repos/asf/incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngTextTest.java

   This functionality will be in the next release.  You can also make
yourself a snapshot build from the SVN repository.  Instructions on
how to do that are in the FAQ:

http://cwiki.apache.org/confluence/display/SANSELAN/FAQ

Charles.

ps. Philipp: I think Ben was asking how to embed text metadata into a
Png using the tEXt chunk, not how to draw text onto the image, which
your example helpfully demonstrates.


On Mon, Aug 4, 2008 at 5:06 PM,  <[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
> I have a couple of questions regarding Sanselan.
>
>
>
> Firstly is there a user forum for the project I can direct my queries
> to?
>
>
>
> Secondly, I would like to know if Sanselan is at the point where a tEXt
> chunk can be inserted into a PNG image. If so, how is this done? I have
> been using v0.94 but I can't make it do what I need.
>
>
>
> I wish to embed an XML String containing meta data describing the image
> file. I have written the function below. I think I have generated the
> PNGChunktEXt correctly but without seeing an example I am not sure. If
> it is correct, I still I don't know how to get it into the byte array
> holding the png image.
>
>
>
> I would appreciate any advice you could give.
>
>
>
>            static public byte [] changePngMetadata(byte [] pngImage,
> String xmlString) throws ImageReadException, IOException
>
>            {
>
>
>
>                        String txtString = "TcsMetaData" + '\0' +
> xmlString;
>
>
>
>                        PngCrc pngCrc = new PngCrc();
>
>                        int iCRC = pngCrc.crc(txtString.getBytes(),
> txtString.length());
>
>
>
>                        //May want to use compressed text instead. Do I
> need to compress the text string separately?
>
>                        PNGChunktEXt txt = new
> PNGChunktEXt(txtString.length(), PngConstants.tEXt, iCRC,
> txtString.getBytes());
>
>
>
>                        String kw = txt.getKeyword();
>
>                        String tx = txt.getText();
>
>
>
>                        //How do I insert txt into pngImage?
>
>
>
>                        return pngImage;
>
>            }
>
>
>
> Regards,
>
>
>
> Ben
>
>
>
>
>
> This email and any files attached are intended for the addressee and may 
> contain information of a confidential nature. If you are not the intended 
> recipient, be aware that this email was sent to you in error and you should 
> not disclose, distribute, print, copy or make other use of this email or its 
> attachments. Such actions, in fact, may be unlawful. In compliance with the 
> various Regulations and Acts, General Dynamics United Kingdom Limited 
> reserves the right to monitor (and examine for viruses) all emails and email 
> attachments, both inbound and outbound. Email communications and their 
> attachments may not be secure or error- or virus-free and the company does 
> not accept liability or responsibility for such matters or the consequences 
> thereof.  General Dynamics United Kingdom Limited, Registered Office: 100 New 
> Bridge Street, London EC4V 6JA. Registered in England and Wales No: 1911653.
>

Reply via email to