Page 1 of 1

certain PNGs cannot be saved

Posted: Fri Nov 21, 2014 11:34 pm
by CreativeWorld
I have a PNG image with an embedded ICC profile produced by GhostScript from a PDF page. If you try to (re)save it, it will just get truncated with "Error writing the file" message.
I'm using latest 2.25, 2.22 had the same issue.

Re: certain PNGs cannot be saved

Posted: Sun Nov 23, 2014 9:44 am
by xnview
i can't reproduce, you save into PNG?

Re: certain PNGs cannot be saved

Posted: Mon Nov 24, 2014 5:00 am
by XnTriq
Steps to reproduce (v2.25):
  1. Download the attached sample.png.
  2. Open it in XnView.
  3. Press Ctrl+S.
  4. Confirm the first message with Yes (“The file <X:\Test\sample.png> already exists ! Do you want to overwrite it ?”).
  5. Confirm the second message with OK (“Be careful, saving in this format will lose existing metadata!”).
  6. Confirm the third message with OK (“Warning: Error writing the file <X:\Test\sample.png>”).
:bugconfirmed: The size of sample.png will be reduced to 0 bytes.

EDIT: Works fine in v1.99.6

Re: certain PNGs cannot be saved

Posted: Tue Nov 25, 2014 9:32 am
by xnview
i can't reproduce :(

Re: certain PNGs cannot be saved

Posted: Wed Nov 26, 2014 12:00 am
by XnTriq
xnview wrote:i can't reproduce :(
Here's the xnview.ini I use for my tests:

Code: Select all

[Cache]
IsActive=0
SavingMode=1

[Start]
ParamsSavingMode=1
SavingMode=1
Deleting the iCCP chunk (“Artifex Software sRGB ICC Profile”) with TweakPNG enables XnView to resave sample.png.
TweakPNG ([color=green]default_rgb.icc[/color]) wrote:

Code: Select all

Compressed size: 2341
Uncompressed size: 2576

― Header ―
Profile size: 2576
Preferred CMM type: “”
Profile version: 2.1.0
Profile/device class: “mntr”
Data color space: “RGB ”
Profile connection space: “XYZ ”
Profile creation time: 0-00-00 00:00:00 UTC
Profile file signature: “acsp”
Primary platform: “APPL”
Embedded profile flag: 0
Dependent profile flag: 0
Device manufacturer: “”
Device model: “”
Attributes: Reflective, Glossy, Positive, Color
Rendering intent: 0 (Perceptual)
Illuminant: X=0.96419, Y=1.00000, Z=0.82489
Profile creator: “”
Profile ID: 00000000000000000000000000000000

― Tags ―
Number of tags: 10
Tag #1 signature=“desc” offset=252 size=124 type=“desc”
	“Artifex Software sRGB ICC Profile”
Tag #2 signature=“cprt” offset=376 size=40 type=“text”
	“Copyright Artifex Software 2011”
Tag #3 signature=“wtpt” offset=416 size=20 type=“XYZ ”
	X=0.95045, Y=1.00000, Z=1.08905
Tag #4 signature=“bkpt” offset=436 size=20 type=“XYZ ”
	X=0.00000, Y=0.00000, Z=0.00000
Tag #5 signature=“rXYZ” offset=456 size=20 type=“XYZ ”
	X=0.43607, Y=0.22249, Z=0.01392
Tag #6 signature=“gXYZ” offset=476 size=20 type=“XYZ ”
	X=0.38515, Y=0.71687, Z=0.09708
Tag #7 signature=“bXYZ” offset=496 size=20 type=“XYZ ”
	X=0.14307, Y=0.06061, Z=0.71410
Tag #8 signature=“rTRC” offset=516 size=2060 type=“curv”
Tag #9 signature=“gTRC” offset=516 size=2060 type=“curv”
Tag #10 signature=“bTRC” offset=516 size=2060 type=“curv”
CreativeWorld ([url=http://newsgroup.xnview.com/viewtopic.php?p=115823#p115823]2.12 XnView: PNG resize[/url]) wrote:XnView versions after 2.05 are unable to (re)save some (?) PNGs, just creates an empty output file and exits without any messages (silently crashes?).
Sample file: http://i58.fastpic.ru/big/2013/1206/fe/ ... 40fffe.png
<--// EDIT //

XnView will resave sample.png without error, if Use ICC Embedded Profile (JPEG/TIFF) - Very slow (Tools » Options... » General » ICC) is activated.

// EDIT //-->

Re: certain PNGs cannot be saved

Posted: Thu Nov 27, 2014 3:01 pm
by xnview
Right there is a problem with embedded icc profile of this png

Re: certain PNGs cannot be saved

Posted: Thu Dec 04, 2014 7:14 pm
by omniplex
XnTriq wrote:TweakPNG
Brilliant tool, I planned to add this to the "other software" forum as a thank you for lots of interesting links (today I read something about JPEG ELA forensics), but obviously you know TweakPNG already. I could post two scripts for the TweakPNG "tools" feature, combining PNGwolf+TruePNG (if anybody uses that, maybe Dos386.)
XnTriq wrote:XnView will resave sample.png without error, if Use ICC Embedded Profile (JPEG/TIFF) - Very slow (Tools » Options... » General » ICC) is activated.
Good to know, as it happens I have that, together with an "sRGB intent saturation" default. Kudos.

Re: certain PNGs cannot be saved

Posted: Sat Dec 06, 2014 11:30 am
by XnTriq
omniplex wrote:
XnTriq wrote:TweakPNG
Brilliant tool, I planned to add this to the "other software" forum as a thank you for lots of interesting links (today I read something about JPEG ELA forensics), but obviously you know TweakPNG already. I could post two scripts for the TweakPNG "tools" feature, combining PNGwolf+TruePNG (if anybody uses that, maybe Dos386.)
I'm glad to hear that you find the links useful, omniplex! (I assume you're referring to JohnFredC's topic about image quality.)
TweakPNG has proven indispensable when it comes to solving PNG mysteries. There's lots of other cool stuff to explore on Jason Summers's site!
omniplex wrote:
XnTriq wrote:XnView will resave sample.png without error, if Use ICC Embedded Profile (JPEG/TIFF) - Very slow (Tools » Options... » General » ICC) is activated.
Good to know, as it happens I have that, together with an "sRGB intent saturation" default. Kudos.
BTW: PngOptimizer discards the iCCP, pHYs as well as the tEXt chunks and combines all IDATs.

Re: certain PNGs cannot be saved

Posted: Sat Aug 01, 2015 6:15 pm
by XnTriq
Update: XnView v2.33 can resave sample.png. Trying to do so with m96yxdgsf6j8.png and 0689d9200169fe5b9a4332ede940fffe.png still results in an “error writing the file”.

See also: Error saving PNG

Re: certain PNGs cannot be saved

Posted: Mon Jan 11, 2016 9:25 pm
by omniplex
XnTriq wrote:Trying to do so with m96yxdgsf6j8.png
[...]
still results in an “error writing the file”.
2.35 can save this. The text chunks are gone (as promised), some 72 dpi pHYs chunk appears out of thin air, and the colour profile isn't identical (original: 2627 bytes, saved: 2520). Maybe libpng "upgrades" known colour profiles on the fly. :?

Unrelated, tweakpng is still at version 1.4.6, and I think its "import colour profile" feature is broken. But it can import complete colour profile chunks (exported from another PNG). Truepng.exe is at version 0.6.1.8, but I haven't tested yet if that fixes a truepng bug with odd PNG formats (IIRC 16bits grayscale didn't work for me with truepng 0.5.1.4.)