Xfig: Problem exporting png format

  • Follow


Hello,

In ubuntu 11.10 via "apt-get install"
I installed Xfig 3.2 patchlevel 5b (Protocol 3.2).

After creating a graphic and trying to save it
in "png" format using the export xfig command,
at the bottom of the export window the three options
"Rescan", "cancel", and "Export" are not available
(these options are gone for any of the export
format options below the Bitmap Formats).

I am hoping to find help on how can I fix such a problem.

Sergio
0
Reply sergio_r (23) 3/25/2012 4:45:24 AM

In comp.os.linux.misc, sergio  <sergio_r@mail.com> wrote:
> In ubuntu 11.10 via "apt-get install"
> I installed Xfig 3.2 patchlevel 5b (Protocol 3.2).
> 
> After creating a graphic and trying to save it
> in "png" format using the export xfig command,
> at the bottom of the export window the three options
> "Rescan", "cancel", and "Export" are not available
> (these options are gone for any of the export
> format options below the Bitmap Formats).

Make sure you have transfig installed as well. That has the
helper program (fig2dev) that actually does the figure file to
Postscript needed for PNG format. Oh yeah, since fig2dev
actually only knows how to translate figure to non-bitmap
formats, to create bitmap output (like PNG, JPEG, and GIF),
you also need some other helper programs. Ghostscript (and
ps2pdf) for PNG and JPEG, and netpbm (or pbmplus) for GIF
and some others. 

Checking xfig.org it looks like 3.2.5b is the latest release
which means Brian Smith has not fixed the bug I pointed out
in February.

If you edit your figures by hand, don't go overboard with comments.
More than 100 lines of comments can crash it. Here's a fix, if you
are compiling from source:

Initially in read.c:

1504 int save_comment(FILE *fp)
1505 {
1506     int             i;
1507 
1508     i=strlen(buf);
1509     /* see if we've allocated space for this comment */
1510     if (comments[numcom])
1511         free(comments[numcom]);

Once the number of comment lines exceed 100, it walks off the
end of the array. Adding in two lines:

1504 int save_comment(FILE *fp)
1505 {
1506     int             i;
1507 
1508     if(numcom >= MAXCOMMENTS)
1509             return 0;
1510     i=strlen(buf);
1511     /* see if we've allocated space for this comment */
1512     if (comments[numcom]) 
1513         free(comments[numcom]);

Makes it just stop reading more comments.

(Xfig tries to save your comments with the object they go with, but
since some objects are not allowed to have comments, all of the
comments at the start of the file get attached to the first object,
and if you have 101+ lines, well...)

Elijah
------
doesn't mind the comment thing so much but wishes xfig had thinner lines
0
Reply Eli 3/25/2012 5:16:10 AM


El domingo 25 de marzo de 2012 01:16:10 UTC-4, Eli the Bearded  escribi=F3:
> In comp.os.linux.misc, sergio  <sergio_r@mail.com> wrote:
> > In ubuntu 11.10 via "apt-get install"
> > I installed Xfig 3.2 patchlevel 5b (Protocol 3.2).
> >=20
> > After creating a graphic and trying to save it
> > in "png" format using the export xfig command,
> > at the bottom of the export window the three options
> > "Rescan", "cancel", and "Export" are not available
> > (these options are gone for any of the export
> > format options below the Bitmap Formats).
>=20
> Make sure you have transfig installed as well. That has the
> helper program (fig2dev) that actually does the figure file to
> Postscript needed for PNG format. Oh yeah, since fig2dev
> actually only knows how to translate figure to non-bitmap
> formats, to create bitmap output (like PNG, JPEG, and GIF),
> you also need some other helper programs. Ghostscript (and
> ps2pdf) for PNG and JPEG, and netpbm (or pbmplus) for GIF
> and some others.=20
>=20
> Checking xfig.org it looks like 3.2.5b is the latest release
> which means Brian Smith has not fixed the bug I pointed out
> in February.
>=20
> If you edit your figures by hand, don't go overboard with comments.
> More than 100 lines of comments can crash it. Here's a fix, if you
> are compiling from source:
>=20
> Initially in read.c:
>=20
> 1504 int save_comment(FILE *fp)
> 1505 {
> 1506     int             i;
> 1507=20
> 1508     i=3Dstrlen(buf);
> 1509     /* see if we've allocated space for this comment */
> 1510     if (comments[numcom])
> 1511         free(comments[numcom]);
>=20
> Once the number of comment lines exceed 100, it walks off the
> end of the array. Adding in two lines:
>=20
> 1504 int save_comment(FILE *fp)
> 1505 {
> 1506     int             i;
> 1507=20
> 1508     if(numcom >=3D MAXCOMMENTS)
> 1509             return 0;
> 1510     i=3Dstrlen(buf);
> 1511     /* see if we've allocated space for this comment */
> 1512     if (comments[numcom])=20
> 1513         free(comments[numcom]);
>=20
> Makes it just stop reading more comments.
>=20
> (Xfig tries to save your comments with the object they go with, but
> since some objects are not allowed to have comments, all of the
> comments at the start of the file get attached to the first object,
> and if you have 101+ lines, well...)
>=20
> Elijah
> ------
> doesn't mind the comment thing so much but wishes xfig had thinner lines

Thanks, Elijah , for replying.

All the program and libraries you mention are=20
already installed:
>$ locate netpbm
   /usr/lib/libnetpbm.so.10
   /usr/lib/libnetpbm.so.10.0
   /usr/share/netpbm
>$ locate fig2dev
   /usr/bin/fig2dev
   /usr/share/xfig/fig2dev

To test fig2dev, I was able to make a png file from a fig=20
(xfig) file via command line:
>$ fig2dev -L png fig_1.fig fig_1.png

  Could it happen that xfig is not finding fig2dev?

Sergio
By the way, the following output shows that the linking
to some libraries seems to be right:=20

>$ ldd /usr/bin/xfig
	linux-vdso.so.1 =3D>  (0x00007fff5f7ff000)
	libjpeg.so.62 =3D> /usr/lib/x86_64-linux-gnu/libjpeg.so.62 (0x00007f70cf54=
b000)
	libXpm.so.4 =3D> /usr/lib/libXpm.so.4 (0x00007f70cf339000)
	libpng12.so.0 =3D> /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f70cf111000=
)
	libXi.so.6 =3D> /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007f70cef01000)
	libXaw3d.so.6 =3D> /usr/lib/libXaw3d.so.6 (0x00007f70cec92000)
	libXt.so.6 =3D> /usr/lib/x86_64-linux-gnu/libXt.so.6 (0x00007f70cea2d000)
	libX11.so.6 =3D> /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f70ce6f5000=
)
	libm.so.6 =3D> /lib/x86_64-linux-gnu/libm.so.6 (0x00007f70ce470000)
	libc.so.6 =3D> /lib/x86_64-linux-gnu/libc.so.6 (0x00007f70ce0cf000)
	libz.so.1 =3D> /lib/x86_64-linux-gnu/libz.so.1 (0x00007f70cdeb7000)
	libXext.so.6 =3D> /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f70cdca30=
00)
	libXmu.so.6 =3D> /usr/lib/libXmu.so.6 (0x00007f70cda8a000)
	libSM.so.6 =3D> /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007f70cd882000)
	libICE.so.6 =3D> /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007f70cd667000=
)
	libxcb.so.1 =3D> /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f70cd44b000=
)
	libdl.so.2 =3D> /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f70cd247000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f70cf797000)
	libuuid.so.1 =3D> /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f70cd041000)
	libXau.so.6 =3D> /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f70cce3e000=
)
	libXdmcp.so.6 =3D> /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f70ccc3=
7000)

0
Reply sergio_r (23) 3/25/2012 1:33:09 PM

El domingo 25 de marzo de 2012 01:16:10 UTC-4, Eli the Bearded  escribi=F3:
> In comp.os.linux.misc, sergio  <sergio_r<at>mail.com> wrote:
> > In ubuntu 11.10 via "apt-get install"
> > I installed Xfig 3.2 patchlevel 5b (Protocol 3.2).
> >=20
> > After creating a graphic and trying to save it
> > in "png" format using the export xfig command,
> > at the bottom of the export window the three options
> > "Rescan", "cancel", and "Export" are not available
> > (these options are gone for any of the export
> > format options below the Bitmap Formats).
>=20
> Make sure you have transfig installed as well. That has the
> helper program (fig2dev) that actually does the figure file to
> Postscript needed for PNG format. Oh yeah, since fig2dev
> actually only knows how to translate figure to non-bitmap
> formats, to create bitmap output (like PNG, JPEG, and GIF),
> you also need some other helper programs. Ghostscript (and
> ps2pdf) for PNG and JPEG, and netpbm (or pbmplus) for GIF
> and some others.=20
> ...
> Elijah
> ------
> doesn't mind the comment thing so much but wishes xfig had thinner lines

Thanks, Elijah , for replying.

All the program and libraries you mention are=20
already installed:
>$ locate netpbm
   /usr/lib/libnetpbm.so.10
   /usr/lib/libnetpbm.so.10.0
   /usr/share/netpbm
>$ locate fig2dev
   /usr/bin/fig2dev
   /usr/share/xfig/fig2dev

To test fig2dev, I was able to make a png file from a fig=20
(xfig) file via command line:
>$ fig2dev -L png fig_1.fig fig_1.png

  Could it happen that xfig is not finding fig2dev?

Sergio
By the way, the following output shows that the linking
to some libraries seems to be right:=20

>$ ldd /usr/bin/xfig
	linux-vdso.so.1 =3D>  (0x00007fff5f7ff000)
	libjpeg.so.62 =3D> /usr/lib/x86_64-linux-gnu/libjpeg.so.62 (0x00007f70cf54=
b000)
	libXpm.so.4 =3D> /usr/lib/libXpm.so.4 (0x00007f70cf339000)
	libpng12.so.0 =3D> /lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f70cf111000=
)
	libXi.so.6 =3D> /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007f70cef01000)
	libXaw3d.so.6 =3D> /usr/lib/libXaw3d.so.6 (0x00007f70cec92000)
	libXt.so.6 =3D> /usr/lib/x86_64-linux-gnu/libXt.so.6 (0x00007f70cea2d000)
	libX11.so.6 =3D> /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f70ce6f5000=
)
	libm.so.6 =3D> /lib/x86_64-linux-gnu/libm.so.6 (0x00007f70ce470000)
	libc.so.6 =3D> /lib/x86_64-linux-gnu/libc.so.6 (0x00007f70ce0cf000)
	libz.so.1 =3D> /lib/x86_64-linux-gnu/libz.so.1 (0x00007f70cdeb7000)
	libXext.so.6 =3D> /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f70cdca30=
00)
	libXmu.so.6 =3D> /usr/lib/libXmu.so.6 (0x00007f70cda8a000)
	libSM.so.6 =3D> /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007f70cd882000)
	libICE.so.6 =3D> /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007f70cd667000=
)
	libxcb.so.1 =3D> /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f70cd44b000=
)
	libdl.so.2 =3D> /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f70cd247000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f70cf797000)
	libuuid.so.1 =3D> /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f70cd041000)
	libXau.so.6 =3D> /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f70cce3e000=
)
	libXdmcp.so.6 =3D> /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f70ccc3=
7000)
0
Reply sergio_r (23) 3/25/2012 1:45:27 PM

In comp.os.linux.misc,  <sergio_r@mail.com> wrote:
> All the program and libraries you mention are 
> already installed:
> >$ locate netpbm
>    /usr/lib/libnetpbm.so.10
>    /usr/lib/libnetpbm.so.10.0
>    /usr/share/netpbm

Netpbm is actually a suite of some 50 to 150 different programs.
There are a huge number of (format)topnm or (format)toppm (etc)
programs, a large number of programs to operate on the PNM family
of files (in and out to PNM) and then a family to export PNM to
various output formats. Imagemagick's convert provides a mostly
overlapping feature set, but as a single program. PBM does it in
the Unix "one tool for one task" mentality. 

(Netpbm and pbmplus are two forks of the same toolset, named for
the most basic file, the Portable BitMap. PBM is 1 bit black and
white. PGM is 2 to 16 bit Portable GrayMAP. PPM is 2 to 16 bit
per color RGB, PAM is a more general multichanel, and PNM is the
wildcard name for the whole family. They are all uncompressed raw
files optimized for ease of use by programmers and not intended for
permanent file storage due to file sizes. These days with disk so
cheap, people keep camera RAW files around and PNM doesn't seem
extravagant anymore.)

> >$ locate fig2dev
>    /usr/bin/fig2dev
>    /usr/share/xfig/fig2dev
> 
> To test fig2dev, I was able to make a png file from a fig 
> (xfig) file via command line:
> >$ fig2dev -L png fig_1.fig fig_1.png
> 
>   Could it happen that xfig is not finding fig2dev?

Perhaps or some other issue. I don't often use the export options.
You might need to have the file saved as a figure before it works
or something else subtle. I find using fig2dev directly offers more
control, and I'm something of a command line bigot, so...

> By the way, the following output shows that the linking
> to some libraries seems to be right: 

Nothing looks odd with the linking, to me.

Elijah
------
will always use PBM tools over Imagemagick given the option
0
Reply Eli 3/26/2012 3:55:19 AM

sergio <sergio_r@mail.com> wrote:
> Hello,
Hi
> 
<snip>

> at the bottom of the export window the three options
> "Rescan", "cancel", and "Export" are not available
<snip>

Try adding these to your ~/.Xdefaults

Fig.library_dir: /usr/lib64/X11/xfig/Libraries
Fig.keyFile: /usr/lib64/X11/xfig/CompKeyDB

Remember to change the directories to the actual location
(distro dependent).  Not sure how or if Ubuntu will load
~/.Xdefauls, so if it does not work try this from an Xterm:
  xrdb -load ~/.Xdefaults
and execute xfig.

> 
> Sergio
HTH
John
0
Reply jmccue (3) 3/26/2012 11:23:07 PM

5 Replies
227 Views

(page loaded in 0.101 seconds)

Similiar Articles:









7/25/2012 4:49:36 AM


Reply: