Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

create bitmap without Tk

56 views
Skip to first unread message

mz

unread,
Aug 31, 2010, 5:30:34 AM8/31/10
to
Hello Group

Has somebody experiance with create image (bmp-file) in the background
(without tk)?
I must create a bmp-file 512x32 with one or two row text in it.
Is there a library or a package for this?

Marc

Harald Oehlmann

unread,
Aug 31, 2010, 7:39:33 AM8/31/10
to

Hello Mark,
if Tk is available but only invisible, you may use the tk image
family.
To put the text into it, you may use the extension LRItext:
http://wfr.tcl.tk/LRIText
To save it as BMP, you may use the extension Img.

A second very funny possibility with tk is to create the image as tk
widget (canvas) and use the Img extension to make a screenshot of the
widget and save it as bmp

If this is not an option for you, you may use:
- ImageMagic with tkMagic (may be complicated)
- image extension (easy to use, requires commercial licence)

Alexandre Ferrieux

unread,
Aug 31, 2010, 8:10:50 AM8/31/10
to
On Aug 31, 1:39 pm, Harald Oehlmann <wortka...@yahoo.de> wrote:
>
> A second very funny possibility with tk is to create the image as tk
> widget (canvas) and use the Img extension to make a screenshot of the
> widget and save it as bmp

Unfortunately, this snapshot method only works on the physical screen
(it even clips the canvas if its not entirely on-screen), so it won't
work in invisible (non-packed-nor-gridded) mode :/

-Alex

Robert Heller

unread,
Aug 31, 2010, 8:42:02 AM8/31/10
to
At Tue, 31 Aug 2010 04:39:33 -0700 (PDT) Harald Oehlmann <wort...@yahoo.de> wrote:

>
> On 31 Aug., 11:30, mz <m...@panorgan.ch> wrote:
> > Has somebody experiance with create image (bmp-file) in the background
> > (without tk)?
> > I must create a bmp-file 512x32 with one or two row text in it.
> > Is there a library or a package for this?
>
> Hello Mark,
> if Tk is available but only invisible, you may use the tk image
> family.

This will only work if there is a X11 server to talk to. Even with .
withdrawn, Tk still needs to 'talk' to the X11 server -- it will crash
otherwise. You can't use the 'image' function until you have done a
'package require Tk', while will call the X11 open display function,
even if you promptly do a 'wm withdraw .' ... Not an option from cron
jobs, webserver CGI scripts, etc.

> To put the text into it, you may use the extension LRItext:
> http://wfr.tcl.tk/LRIText
> To save it as BMP, you may use the extension Img.
>
> A second very funny possibility with tk is to create the image as tk
> widget (canvas) and use the Img extension to make a screenshot of the
> widget and save it as bmp
>
> If this is not an option for you, you may use:
> - ImageMagic with tkMagic (may be complicated)
> - image extension (easy to use, requires commercial licence)

There is also the gd extension. The gd extension is NOT dependent on
Tk and makes no use of X11 or image. And the gd extension includes a
draw text function (you have a choice of a couple of fonts and the text
can be scaled, colored, rotated, etc.). The Gd package is happy to
live with 'bare' tclsh -- just the thing for batch jobs, cron jobs, CGI
scripts, etc.


--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
hel...@deepsoft.com -- Contract Programming: C/C++, Tcl/Tk


MSEdit

unread,
Aug 31, 2010, 9:19:44 AM8/31/10
to
On Aug 31, 2:42 pm, Robert Heller <hel...@deepsoft.com> wrote:
> Deepwoods Software        -- Linux Installation and Administrationhttp://www.deepsoft.com/ -- Web Hosting, with CGI and Database

> hel...@deepsoft.com       -- Contract Programming: C/C++, Tcl/Tk

BLT has some text to image stuff for rotated text I do not know if it
requires TK though.
THe Pixane extension handles images without TK but its future is
currently unknown.

Martyn

mz

unread,
Aug 31, 2010, 11:13:03 AM8/31/10
to
> There is also the gd extension.  The gd extension is NOT dependent on
> Tk and makes no use of X11 or image.  And the gd extension includes a
> draw text function (you have a choice of a couple of fonts and the text
> can be scaled, colored, rotated, etc.).  The Gd package is happy to
> live with 'bare' tclsh -- just the thing for batch jobs, cron jobs, CGI
> scripts, etc.

Thanks everybody for the help.

I have now installed gdlib and tclgd and it works nearly fine.
I have the problem with the depth of the bmp-file.
The file must be monocrome 1-bit depth how do I configure them in the
tclgd and can someone say what the parameter color for the write_wbmp
command does?

Marc

WJG

unread,
Sep 1, 2010, 9:35:22 AM9/1/10
to
Hi there,

Gnocl has full support for the creation of image graphics including
the creation of text, all done off-screen. As the Gdk libraries upon
which Gnocl is build supports bmp file i/o by default, you may find
all the functionality that you are looking for, and more, in one
single package. There is one caveat, some features have still to be
fully documented, sorry ;-(. but you can always get lots of advice and
support via the google gnocl group.

Here's the current pixbuf doc page: https://sites.google.com/site/gnocltclgtk/to-be-comepleted/gnol-pixbuf

WJG
Gnocl Maintainer

0 new messages