There is Postscript construction code inside the Tcl canvas C code,
which would have to be brought up to more modern standards to allow this
IIRC.
Michael
Is there any other format that Tcl supports to save canvas images
(pdf, tiff, jpeg, etc...) ?
Thank you,
Maura
The code is in the Tk generic dir in the Tk source distribution
TkCanvasPs.c or something like it
(see:
http://tktoolkit.cvs.sourceforge.net/tktoolkit/tk/generic/tkCanvPs.c?view=markup
and
http://tktoolkit.cvs.sourceforge.net/tktoolkit/tk/generic/prolog.ps?view=markup
)
>
> Is there any other format that Tcl supports to save canvas images
> (pdf, tiff, jpeg, etc...) ?
Yes. The Img package has some support:
http://wiki.tcl.tk/Img
For PDF there is the trampoline package:
http://wiki.tcl.tk/13033
And see this page for Canvas to SVG code:
http://wiki.tcl.tk/4534
Michael
You could try to postprocess the PostScript via ps2ps or pstops or
some other filter. But since in the case of image/photo objects in
the canvas most of the info will be bitmap style (?), I doubt that
there is much to gain...
R'
*Should* core Tcl emit PostScript Level 2? Can someone closer
to the action summarize the issue?
As I understand it, everything that is in level 1 is OK in the other
higher levels. The only real reason for changing things would be if
there was some feature available in level 2 or 3 that we need for a
better rendering of the output. But I don't know enough about the
higher levels to know much about that; my own expertise is strictly at
the 'level 1' stage anyway.
Donal.
Test #1
- save the canvas image to a Postscript file
- convert the eps file to pdf
- compress the eps file (gzip)
- compress the pdf file (gzip)
Now compare the respective sizes of the eps and pdf files (from 10s of
MB to some 100s of KB),
Compare the respective size of the eps and its compressed version
(eps.gz). You'll notice that gzip han sustantially cut down the
original eps size.
Now compare the size of the pdf file with its compressed version
(pdf.gz). You'll notice that the two sizes are comparable.
>From the above I infer that pdf is a pretty optimized format whereas
its eps counterpart contains a lot of useless data that gzip cuts off
based on an almost lossless information scheme.
Test #1
- load a sophisticated image with GIMP and save it to an eps level-1
file
- load the same image with GIMP and save it to an eps level-2 file
- print both files through a color printer (a good one)
Compare the respective size ... you'll realize how much disk space is
saved by savng to eps level-2.
Compare the two print-outs. You can hardly find any difference at all
!!!
Maura
pdf already provides (efficient) compression for content.
Postscript level 2 introduced the ability to handle compressed data.
< quote from http://partners.adobe.com/public/developer/en/pdf/PDFReference16.pdf >
2.2.2 Compression
To reduce file size, PDF supports a number of industry-standard compression
filters:
• JPEG and (in PDF 1.5) JPEG2000 compression of color and grayscale images
• CCITT (Group 3 or Group 4), run-length, and (in PDF 1.4) JBIG2 compres-
sion of monochrome images
• LZW (Lempel-Ziv-Welch) and (beginning with PDF 1.2) Flate compression of
text, graphics, and images
Using JPEG compression, color and grayscale images can be compressed by a fac-
tor of 10 or more. Effective compression of monochrome images depends on the
compression filter used and the properties of the image, but reductions of 2:1 to
8:1 are common (or 20:1 to 50:1 for JBIG2 compression of an image of a page full
of text). LZW or Flate compression of the content streams describing all other
text and graphics in the document results in compression ratios of approximately
2:1. All of these compression filters produce binary data, which can be further
converted to ASCII base-85 encoding if a 7-bit ASCII representation is required.
</quote>
found on http://partners.adobe.com/public/developer/pdf/index_reference.html
uwe