Loading ...
Sorry, an error occurred while loading the content.

RE: [exceptional-performance] Ancillary Data in PNGs

Expand Messages
  • Stoyan Stefanov
    Hi Rob, Seems like it s pretty safe to remove all but the transparency chunks. I think removing the background chunk actually has a positive effect on some
    Message 1 of 3 , May 13, 2008
    View Source
    • 0 Attachment

      Hi Rob,

       

      Seems like it’s pretty safe to remove all but the transparency chunks. I think removing the background chunk actually has a positive effect on some browsers that have a problem where setting the same color as both PNG background and as CSS background results in two different colors.

       

      Stripping chunks may look like an extreme optimization but it’s not, sometimes it may result in 30-40% file size reduction, without compromising anything.

       

      I think the command is in the slides but basically I would do:

      > pngcrush –rem alla ….

      Which means remove all chinks but keep transparency.

       

      IE6 doesn’t support alpha transparency in PNG32 (shows grey color) but is ok with transparency in PNG8 (semi-transparent pixels are shown as fully transparent)

       

      Best,

      Stoyan

       

       


      From: exceptional-performance@yahoogroups.com [mailto:exceptional-performance@yahoogroups.com] On Behalf Of Rob Szarka
      Sent: Tuesday, May 13, 2008 10:19 AM
      To: exceptional-performance@yahoogroups.com
      Subject: [exceptional-performance] Ancillary Data in PNGs

       


      Here's another question that's vexing me at the moment. This comes
      under the category of "extreme optimization" , I suppose, and when I
      posted this question to LinkedIn I received a few responses
      suggesting that my time would be better spent using various
      techniques I'm sure are already familiar to folks on this list (e.g.
      sprites). So I should preface this by saying that I realize we're
      only talking about 100 bytes or so worth of data, but this is for a
      project where that will pay off.

      The PNG format allows for the inclusion of various ancillary
      data.(http://en.wikipedia .org/wiki/ Portable_ Network_Graphics #Ancillary_ chunks
      has a nice short list.) I'm wondering which of these fields are safe
      to strip from the final version of a PNG that will be displayed on a web page.

      For example, it seems to me that the tIME field should be safe to
      strip, but what about bKGD (the default background color)? I've seen
      reference to poor support in old (e.g. MSIE 4.x) browser versions
      that might rely on this attribute as a fallback when unable to handle
      transparency information properly. In fact, the Wikipedia entry
      claims that "Internet Explorer 6 and lower, which does not support
      alpha transparency, will display this color as the background of the
      PNG". If true, what will happen when this data is not available? I'm
      willing to accept suboptimal display in ancient browsers, but
      potential problems in current (let's say Firefox 1.x and MSIE 6.x or
      later) versions wouldn't be worth the tiny savings in file size.

      How about pHYs, which I believe the GIMP refers to as "resolution" ?
      Would deleting this information affect printing?

    • Konstantin Käfer
      http://optipng.sourceforge.net/ is supposed to be even better than pngcrush. It s definitely easier to use, though. Konstantin
      Message 2 of 3 , May 17, 2008
      View Source
      • 0 Attachment
        http://optipng.sourceforge.net/ is supposed to be even better than
        pngcrush. It's definitely easier to use, though.

        Konstantin

        On 13.05.2008, at 22:15, Stoyan Stefanov wrote:

        > Hi Rob,
        >
        > Seems like it’s pretty safe to remove all but the transparency
        > chunks. I think removing the background chunk actually has a
        > positive effect on some browsers that have a problem where setting
        > the same color as both PNG background and as CSS background results
        > in two different colors.
        >
        > Stripping chunks may look like an extreme optimization but it’s not,
        > sometimes it may result in 30-40% file size reduction, without
        > compromising anything.
        >
        > I think the command is in the slides but basically I would do:
        > > pngcrush –rem alla ….
        > Which means remove all chinks but keep transparency.
        >
        > IE6 doesn’t support alpha transparency in PNG32 (shows grey color)
        > but is ok with transparency in PNG8 (semi-transparent pixels are
        > shown as fully transparent)
        >
        > Best,
        > Stoyan
        >
        >
        > From: exceptional-performance@yahoogroups.com [mailto:exceptional-performance@yahoogroups.com
        > ] On Behalf Of Rob Szarka
        > Sent: Tuesday, May 13, 2008 10:19 AM
        > To: exceptional-performance@yahoogroups.com
        > Subject: [exceptional-performance] Ancillary Data in PNGs
        >
        >
        > Here's another question that's vexing me at the moment. This comes
        > under the category of "extreme optimization", I suppose, and when I
        > posted this question to LinkedIn I received a few responses
        > suggesting that my time would be better spent using various
        > techniques I'm sure are already familiar to folks on this list (e.g.
        > sprites). So I should preface this by saying that I realize we're
        > only talking about 100 bytes or so worth of data, but this is for a
        > project where that will pay off.
        >
        > The PNG format allows for the inclusion of various ancillary
        > data.(http://en.wikipedia.org/wiki/Portable_Network_Graphics#Ancillary_chunks
        > has a nice short list.) I'm wondering which of these fields are safe
        > to strip from the final version of a PNG that will be displayed on a
        > web page.
        >
        > For example, it seems to me that the tIME field should be safe to
        > strip, but what about bKGD (the default background color)? I've seen
        > reference to poor support in old (e.g. MSIE 4.x) browser versions
        > that might rely on this attribute as a fallback when unable to handle
        > transparency information properly. In fact, the Wikipedia entry
        > claims that "Internet Explorer 6 and lower, which does not support
        > alpha transparency, will display this color as the background of the
        > PNG". If true, what will happen when this data is not available? I'm
        > willing to accept suboptimal display in ancient browsers, but
        > potential problems in current (let's say Firefox 1.x and MSIE 6.x or
        > later) versions wouldn't be worth the tiny savings in file size.
        >
        > How about pHYs, which I believe the GIMP refers to as "resolution"?
        > Would deleting this information affect printing?
        >
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.