Deutsch   English   Français   Italiano  
<slrnv833ko.3gvbf.avl@logic.at>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Andreas Leitgeb <avl@logic.at>
Newsgroups: comp.lang.tcl
Subject: Re: is there an image package that doesn't require Tk ?
Date: Sun, 30 Jun 2024 16:58:00 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <slrnv833ko.3gvbf.avl@logic.at>
References: <slrnv7r2cs.3gvbf.avl@logic.at> <slrnv7ud1t.3gvbf.avl@logic.at>
Reply-To: avl@logic.at
Injection-Date: Sun, 30 Jun 2024 18:58:00 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="0f0d69220911df9582555624287e7151";
	logging-data="627975"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18kBM9NzMsK0vtj4VXfIV/p"
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:5Zvov7Z3UyMtpieJU8SU7//D7go=
Bytes: 1925

Andreas Leitgeb <avl@logic.at> wrote:
> Andreas Leitgeb <avl@logic.at> wrote:
>> I'd like it to open a .png file (screenshot from an android
>> phone) extract five rectangular regions from it, and convert
>> them to something similar to Tk's [$image data] - e.g. a list
>> of lists of colors
> Thanks to all who answered...
> Unfortunately, I haven't yet succeeded with any of the suggestions.

I didn't mean to make anyone "responsible" in any way for a suggestion
made - quite the opposite: I was happy for all suggestions.

In the end I went without tcl package, and merely invoke the 
imagemagick tool "convert" with a list of parameters such that
it writes out an uncompressed bmp3 in 16-colors (palette) mode,
which turned out pretty simple to parse from Tcl code (binary scan).

Given a "list-of-list-of-color", it is amazingly simple
to extract a sub-rectangle:

   proc rect {data x1 y1 x2 y2} {
      lmap row [lrange $data $y1 $y2] { lrange $row $x1 $x2 }
   }

Case closed ;-)