Re: Pure TCL .PNG reader

From: Jochen Loewer (loewerj_at_hotmail.com)
Date: 11/04/03


Date: 4 Nov 2003 01:06:49 -0800

Actually I got the need to write/generate GIF images in a
scripted/automated way at the beginning of this year. So
I started a pure-Tcl GIF generator, which does write GIF
images in an non-compressed way in order to work nicely
with the still existing Unisys/GIF patent.
In the meanwhile the package grew to 'pureimage', which can't
only write small icons in a ascii pating way but also can
draw lines, rectangles, draw X11 fonts (also variable width
fonts like Helvetica).
A PCF font file to pureimage Tcl font converter is part of it.

Example:

PureImage::GIFFile l9.gif { . 444444 X 336699 } {
    .X....X.
    ..X..X..
    ...XX...
    ..X..X..
    .X....X.
}

or in an object-oriented way:

set g [PureImage::Create 50 15]
$g setColor 46 444444
$g setColor 77 336699
$g rect 0 0 50 15 77
$g drawString 1 10 helvR12 77 "Hello from PureImage"
$g asGIFtoFile l4.gif
$g delete

I'm preparing that package to be released in BSD or MPL like
license (tcllib!) for some weeks now, but still need some
time to make it 'nicer'.
Ideally someone can step-in and add another method 'asPNGtoFile'
similar to 'asGIFtoFile', so that also PNG files can be written.
But writing PNG files requires a zlib encoder in pure Tcl, which
is more complex and also slower, but could be reused for other
purposes as well.

Regards,
Jochen Loewer (http://loewerj.freeshell.org)

Arjen Markus <arjen.markus@wldelft.nl> wrote in message news:<3FA61464.6C74F957@wldelft.nl>...
> Daniel wrote:
> >
> > > > Hi, do you know if there is some PNG file reader done in pure tcl?
> > > >
> > > > Tcl 8.3 doesn't support .png files, but we need a platform independent, pure
> > > > tcl, way of reading simple .png files (no transparencies or similar).
> > > >
> > > > Greets. Alvaro.
> > >
> > > It is a simple enough format - look on the Wiki for some such stuff.
> > > (I have a PNG writer in Tcl ...)
> >
> > Is your PNG writer available somewhere? (couldnt find it searching on
> > the Wiki)
> > If a pure Tcl PNG reader/writer was developed, that would be a
> > wonderful solution for adding PNG support to the core, since the main
> > argument against it was the dependency on libpng (that is how tkimg
> > does it).
> >
> > Cheers
> >
> > Daniel
>
> Not yet - it needs (quite) a bit of work and my intention was to make a
> small
> package to draw pictures without Tk :)
>
> I will put the raw code, as it is now on the Wiki -- just done so: page
> <http://wiki.tcl.tk/10289>
>
> Regards,
>
> Arjen



Relevant Pages

  • Re: Mac to PC
    ... They're not really jpeg or gif if they've been copy/pasted. ... PostScript is a printer language. ... PostScript or Type1 fonts. ...
    (microsoft.public.mac.office.powerpoint)
  • Re: How to restore JPEG, GIF, and PNG file associations
    ... > restored for the JPEG, GIF, and PNG files? ... > When some program are installed, file associations may be ...
    (microsoft.public.win2000.registry)
  • display bmp images using JLabel
    ... Hello, I am trying to write a viewer that is able to read/display bmp, jpg, ... gif and png files. ...
    (comp.lang.java.programmer)
  • Re: Image Codecs
    ... Are there equivalent Java codecs for GIF and PNG files as there are ... I have an object that performs image resizing for ...
    (comp.lang.java.programmer)
  • Website crawler auto image downloader
    ... I need a script that will crawl a list of websites and download all .jpg, ... ..gif, .png files. ...
    (php.general)