Menu

#27 16bit Grayscale PNG on MAC OSX looks wrong.

open-accepted
None
5
2003-02-17
2003-02-01
No

I've written some software that produces 16bit
grayscale PNG files. However when I load them into
filmgimp they look wrong. At first I suspected my
software however the data going into the compression
routines looked correct so I downloaded the PNG test
suite at

http://www.schaik.com/pngsuite/pngsuite.html

and loaded the 16bit grayscale test image basn4a16.png
and the outcome was similar to my PNG's.

I've attached a screenshot below, the top square shows
the reference GIF from the test suite, the bottom is
FilmGimps view of the test PNG.

After a small play with the source of my program it
looks like FilmGimp is performing a byte reversal
somewhere. If a create a 32767 grey pixel as 0x7fff I
get a white pixel, if I swap the bytes around to 0xff7f
I get mid grey. PNG data is network endian.

Discussion

  • Sam Richards

    Sam Richards - 2003-02-01

    Logged In: YES
    user_id=211347

    Just to confirm that this worked fine on intel boxes. Could
    somebody on a Mac or SGI take a look at it?

     
  • Sam Richards

    Sam Richards - 2003-02-01

    Logged In: YES
    user_id=211347

    Just to confirm that this worked fine on intel boxes. Could
    somebody on a Mac or SGI take a look at it?

     
  • Sam Richards

    Sam Richards - 2003-02-01

    Logged In: YES
    user_id=211347

    Just to confirm that this worked fine on intel boxes. Could
    somebody on a Mac or SGI take a look at it?

     
  • David Burnett

    David Burnett - 2003-02-17

    Logged In: YES
    user_id=5758

    I'm not an expert in GIMP internals but shouldn't

    if(info->bit_depth == 16)
    png_set_swap(pp);

    in filmgimp/plug-ins/png/png.c

    have an endian test for those platforms that like their
    data big-endian style.

     
  • Sam Richards

    Sam Richards - 2003-02-17

    Logged In: YES
    user_id=211347

    Applying the suggested fix, somebody will have to test the
    upcoming 0.16 release to see if its fixed.

     
  • Sam Richards

    Sam Richards - 2003-02-17
    • assigned_to: nobody --> samrichards
    • status: open --> open-accepted
     
  • David Burnett

    David Burnett - 2003-02-17

    Logged In: YES
    user_id=5758

    I've just compiled fresh from CVS on Mac OSX and it works
    just fine on the PNG suite and my own PNGs.

    Good Stuff.

     

Log in to post a comment.

MongoDB Logo MongoDB