Menu

#4 SNG has problems with control chars in zTXt

open
nobody
None
5
2016-01-10
2012-05-11
ThVortex
No

I'm attaching a file that has control characters in its zTXt text chunk. After converting the .png file to .sng, converting it back to another .png, and once again converting to .sng, I can see that these control characters get stripped out by SNG when I perform a diff of the two .sng files:

< #SNG: from am_engine.png

SNG: from am_engine3.png

44c44
< text: "# BEGIN DMI\nversion = 4.0\n\^Iwidth = 32\n\^Iheight = 64\nstate = \"core_on\"\n\^Idirs = 1\n\^Iframes = 7\n\^Idelay = 3,3,3,3,3,3,3\n\^Irewind = 1\nstate = \"injector_matter_antimatter\"\n\^Idirs = 1\n\^Iframes = 1\nstate = \"injector_antimatter\"\n\^Idirs = 1\n\^Iframes = 1\nstate = \"injector_matter\"\n\^Idirs = 1\n\^Iframes = 1\nstate = \"injector\"\n\^Idirs = 1\n\^Iframes = 1\nstate = \"antimatter_cell\"\n\^Idirs = 1\n\^Iframes = 1\nstate = \"matter_cell\"\n\^Idirs = 1\n\^Iframes = 1\nstate = \"core_connected\"\n\^Idirs = 1\n\^Iframes = 1\nstate = \"core_off\"\n\^Idirs = 1\n\^Iframes = 1\n\^Irewind = 1\n# END DMI\n";


text: "# BEGIN DMI\nversion = 4.0\n^Iwidth = 32\n^Iheight = 64\nstate = \"core_on\"\n^Idirs = 1\n^Iframes = 7\n^Idelay = 3,3,3,3,3,3,3\n^Irewind = 1\nstate = \"injector_matter_antimatter\"\n^Idirs = 1\n^Iframes = 1\nstate = \"injector_antimatter\"\n^Idirs = 1\n^Iframes = 1\nstate = \"injector_matter\"\n^Idirs = 1\n^Iframes = 1\nstate = \"injector\"\n^Idirs = 1\n^Iframes = 1\nstate = \"antimatter_cell\"\n^Idirs = 1\n^Iframes = 1\nstate = \"matter_cell\"\n^Idirs = 1\n^Iframes = 1\nstate = \"core_connected\"\n^Idirs = 1\n^Iframes = 1\nstate = \"core_off\"\n^Idirs = 1\n^Iframes = 1\n^Irewind = 1\n# END DMI\n";

Discussion

  • ThVortex

    ThVortex - 2012-05-11
     
  • Max Horn

    Max Horn - 2013-08-08

    Hm, that png does not seem to contain any zTXt chunk (looking at the file with a hex editor seems to confirm that). And with sng 1.0.5 it seems to survive the roundtrip just fine.

     
  • Max Horn

    Max Horn - 2016-01-10

    Also note that the PNG ISO spec says the following on the content of tEXt and zTXt chunks (see http://www.libpng.org/pub/png/spec/iso/index-object.html#11tEXt): "Characters other than those defined in Latin-1 plus the linefeed character have no defined meaning in tEXt chunks." -- in particular, control characters have undefined meaning.

    That said, I still think they should survive a sng roundtrip; I merely wanted to point out that by including them in the first place, you may already be making a mistake...

     

Log in to post a comment.

MongoDB Logo MongoDB