certain PNGs cannot be saved

Bugs found in XnView Classic. Please report only one bug per topic!

Moderators: XnTriq, xnview

Post Reply
User avatar
CreativeWorld
Posts: 127
Joined: Fri Dec 30, 2011 7:08 pm

certain PNGs cannot be saved

Post 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.
Attachments
sample.png
User avatar
xnview
Author of XnView
Posts: 34090
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: certain PNGs cannot be saved

Post by xnview »

i can't reproduce, you save into PNG?
Pierre.
User avatar
XnTriq
Moderator & Librarian
Posts: 5617
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: certain PNGs cannot be saved

Post 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
User avatar
xnview
Author of XnView
Posts: 34090
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: certain PNGs cannot be saved

Post by xnview »

i can't reproduce :(
Pierre.
User avatar
XnTriq
Moderator & Librarian
Posts: 5617
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: certain PNGs cannot be saved

Post 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 //-->
User avatar
xnview
Author of XnView
Posts: 34090
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: certain PNGs cannot be saved

Post by xnview »

Right there is a problem with embedded icc profile of this png
Pierre.
User avatar
omniplex
Posts: 127
Joined: Thu Feb 10, 2011 1:52 pm
Location: Hamburg
Contact:

Re: certain PNGs cannot be saved

Post 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.
User avatar
XnTriq
Moderator & Librarian
Posts: 5617
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: certain PNGs cannot be saved

Post 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.
User avatar
XnTriq
Moderator & Librarian
Posts: 5617
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: certain PNGs cannot be saved

Post 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
User avatar
omniplex
Posts: 127
Joined: Thu Feb 10, 2011 1:52 pm
Location: Hamburg
Contact:

Re: certain PNGs cannot be saved

Post 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.)
Post Reply