incubator-sanselan-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Ben.Fe...@generaldynamics.uk.com>
Subject tEXt chunk in PNG
Date Mon, 04 Aug 2008 15:06:12 GMT
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.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message