xfig produces illegal PNG file when exporting as PNG

Bug #381668 reported by Dominique Pellé
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
transfig
New
Undecided
Unassigned
transfig (Ubuntu)
New
Undecided
Unassigned
xfig (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: xfig

Summary: Exporting a figure as PNG with xfig produces illegal PNG file.

Steps to reproduce:

1/ start 'xfig foo.fig' from command line:
    $ xfig foo.fig

2/ draw something (it does not matter what you draw)

3/ Export as PNG with: File -> Export
    In the export dialog box, select "Language: PNG (Portable Network Graphic)"
    and click "Export" button

4/ observe that xfig has produce file "foo.png" (so far so good)

5/ Now run "optipng" tool from command line with:
    $ optipng foo.png

6/ Observe the following error:

$ optipng foo.png
OptiPNG 0.6.2.1: Advanced PNG optimizer.
Copyright (C) 2001-2009 Cosmin Truta.

** Processing: foo.png
Warning: Extraneous data found after IEND
39x39 pixels, 3x8 bits/pixel, RGB
Reducing image to 1 bit/pixel, 2 colors in palette
Recoverable errors found in input. Rerun OptiPNG with the -fix option.
Error: Previous error(s) not fixed

** Status report
1 file(s) have been processed.
1 error(s) have been encountered.

-> the PNG file is illegal. It can be corrected though with "optipng -fix foo.png".

I'm using xfig as shipped with Ubuntu 9.04 (Jaunty)
$ xfig -v
Xfig 3.2 patchlevel 5 (Protocol 3.2)

Revision history for this message
Dominique Pellé (dominique-pelle) wrote :

pngcheck tool also complains about the PNG file produced by xfig (so it's not only optipng):

$ pngcheck foo.png
foo.png additional data after IEND chunk

Revision history for this message
Dominique Pellé (dominique-pelle) wrote :

This bug is still present in Ubuntu-9.10 (Karmic Koala)

Revision history for this message
Dominique Pellé (dominique-pelle) wrote :

This bug is still present in Ubuntu-10.04

Revision history for this message
David Lee Lambert (davidl) wrote :

This doesn't seem to be a problem with Xfig itself; rather with the "transfig" helper program (a separate install in Ubuntu), which in turn calls GhostScript as part of the process of producing PNG files.

Somehow it writes two concatenated PNG images to the output file; the first has the image data, the second one is blank, the same size as the image. I can't seem to duplicate this behavior by taking a PDF from another program, converting it to PostScript, and running "gs -q -dSAFER -sDEVICE=png16m -r80 -g850x1100 -sOutputFile=file.png - <file.ps"; so it's probably not a problem with GhostScript, just with the PostScript that xfig produces.

Revision history for this message
Roland Rosenfeld (roland) wrote :

This isn't a problem in xfig, since xfig doesn't create png files, but delegates this to fig2dev program, which currently is contained in package fig2dev and in former versions in transfig package.

I tried this out with current version of the program and wasn't able to reproduce this problem.
Please try again with a newer version and tell me, weather it works now.
Please also check version number of fig2dev used.

Revision history for this message
Roland Rosenfeld (roland) wrote :

this is in fig2dev/transfig, not in xfig.

Changed in xfig (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.