[Gambas-user] Ideas needed ?how to track down corruption of png file

richard terry rterry at ...1946...
Mon Dec 1 21:39:30 CET 2008


On Tue, 2 Dec 2008 12:25:10 am you wrote:
> On lundi 1 décembre 2008, richard terry wrote:
> > I've mentioned recently that my re-loading of images from postgres back
> > into my program is failing - the images seem to save correctly but on
> > retrieving them they fail to display in khtml or konqueror if I load the
> > tempfile from the desktop
> >
> > They will load into gimp, albeit with an error message as shown in the
> > accompanying pictures.
> >
> > I wondered if anyone had any clue how to proceed to help me track this
> > down, or suggestions as to another forum one could find out.
> >
> > Regards
> >
> > richard
>
> Can you make a copy of the the PictureDatabase example, change its source
> code to use your postgresql database, and try to load then save the same
> image, and see if it corrupted?

Ok, I will try, I did copy this module in the first place so used the same 
code exactly, however I will maybe try and create a mini database with one 
table and send you the code.

However, of interest I looked at png files created in any paint program, or 
using gambas, they all have this structure:


�PNG


IHDR
   <rest of the pictures bytes in here>

    IEND�B`�

Now, the string that gets sent to postgres, looks like this:

\\211PNG\\015\\012\\032\\012\\000\\000\\000\\015IHDR\\000\\000\\000\

<rest of bytes in here>

\214#\\323\\000\\000\\000\\000IEND\\256B`\\202


However, when pulled back from postgres and re-constituted (using the same 
code as in the picture database, this bit is missing off the end:

  IEND�B`�.

Gimp will ignore that, and load the picture with an error, but most other 
paint programs throw up a libpng error a and baulk.

I will try as I say to make a small program so someone else can look at it.

Regards and thanks.

Richard




More information about the User mailing list