• is there an image package that doesn't require Tk ?

    From Andreas Leitgeb@avl@logic.at to comp.lang.tcl on Thu Jun 27 15:47:40 2024
    From Newsgroup: comp.lang.tcl

    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

    For now, I use "image photo" to scrape(simple ocr) some numbers
    from it, but it only works with Tk. In the end I want to do
    the processing of the image in the same cron-script that gets
    the screenshot from the phone.

    If nothing else, I'd "convert" (from Imagemagick) the png to
    something I can easier parse in Tcl.

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Gerald Lester@Gerald.Lester@gmail.com to comp.lang.tcl on Thu Jun 27 11:22:05 2024
    From Newsgroup: comp.lang.tcl

    On 6/27/24 10:47, Andreas Leitgeb 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

    For now, I use "image photo" to scrape(simple ocr) some numbers
    from it, but it only works with Tk. In the end I want to do
    the processing of the image in the same cron-script that gets
    the screenshot from the phone.

    If nothing else, I'd "convert" (from Imagemagick) the png to
    something I can easier parse in Tcl.


    http://www.graphicsmagick.org/TclMagick/doc/TclMagick.html
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From ted@loft.tnolan.com (Ted Nolan@tednolan to comp.lang.tcl on Thu Jun 27 16:31:14 2024
    From Newsgroup: comp.lang.tcl

    In article <slrnv7r2cs.3gvbf.avl@logic.at>,
    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

    For now, I use "image photo" to scrape(simple ocr) some numbers
    from it, but it only works with Tk. In the end I want to do
    the processing of the image in the same cron-script that gets
    the screenshot from the phone.

    If nothing else, I'd "convert" (from Imagemagick) the png to
    something I can easier parse in Tcl.


    It's not clear to me if this still works, but there is:

    https://wiki.tcl-lang.org/page/TclMagick
    --
    columbiaclosings.com
    What's not in Columbia anymore..
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Thu Jun 27 19:42:28 2024
    From Newsgroup: comp.lang.tcl

    Am 27.06.2024 um 17:47 schrieb Andreas Leitgeb:
    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

    For now, I use "image photo" to scrape(simple ocr) some numbers
    from it, but it only works with Tk. In the end I want to do
    the processing of the image in the same cron-script that gets
    the screenshot from the phone.

    If nothing else, I'd "convert" (from Imagemagick) the png to
    something I can easier parse in Tcl.


    To my knowledge, there is the CRIMP package by Andreas Kupries.

    https://core.tcl-lang.org/akupries/crimp/home

    And I would love to get the image code a loadable extension of Tk, so it
    may be loaded without Tk.
    I already looked into this. It is far from trivial, as there are many
    direct interaction between widget code and core image code...

    And I would love to remove a lot of old stuff from the image code. We
    missed this with Tk 9.0...

    Any help appreciated...

    Thanks,
    Harald
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Paul Obermeier@obermeier@poSoft.de to comp.lang.tcl on Thu Jun 27 20:36:06 2024
    From Newsgroup: comp.lang.tcl

    You may look at tclgd (https://github.com/flightaware/tcl.gd).
    A working version is part of BAWT.

    Paul


    Am 27.06.2024 um 17:47 schrieb Andreas Leitgeb:
    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

    For now, I use "image photo" to scrape(simple ocr) some numbers
    from it, but it only works with Tk. In the end I want to do
    the processing of the image in the same cron-script that gets
    the screenshot from the phone.

    If nothing else, I'd "convert" (from Imagemagick) the png to
    something I can easier parse in Tcl.


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From greg@gregor.ebbing@gmx.de to comp.lang.tcl on Thu Jun 27 21:38:09 2024
    From Newsgroup: comp.lang.tcl

    Am 27.06.24 um 17:47 schrieb Andreas Leitgeb:
    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

    For now, I use "image photo" to scrape(simple ocr) some numbers
    from it, but it only works with Tk. In the end I want to do
    the processing of the image in the same cron-script that gets
    the screenshot from the phone.

    If nothing else, I'd "convert" (from Imagemagick) the png to
    something I can easier parse in Tcl.

    Hello

    https://wiki.tcl-lang.org/page/Pixane


    via webarchives
    but without source code and no binaries for win 64

    It works with Linux 32 and 64 bit


    Gregor
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Fri Jun 28 08:29:49 2024
    From Newsgroup: comp.lang.tcl

    Am 27.06.2024 um 21:38 schrieb greg:
    Am 27.06.24 um 17:47 schrieb Andreas Leitgeb:
    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

    For now, I use "image photo" to scrape(simple ocr) some numbers
    from it, but it only works with Tk.  In the end I want to do
    the processing of the image in the same cron-script that gets
    the screenshot from the phone.

    If nothing else, I'd "convert" (from Imagemagick) the png to
    something I can easier parse in Tcl.

    Hello

    https://wiki.tcl-lang.org/page/Pixane


    via webarchives
    but without source code and no binaries for win 64

    It works with Linux 32 and 64 bit


    Gregor

    Yes, as there is no standard package, there are many solutions.
    That is why I would like the image command from Tk as a loadable package
    for TCL.

    Thanks,
    Harald
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From greg@gregor.ebbing@gmx.de to comp.lang.tcl on Fri Jun 28 20:16:10 2024
    From Newsgroup: comp.lang.tcl

    Am 27.06.24 um 21:38 schrieb greg:
    Am 27.06.24 um 17:47 schrieb Andreas Leitgeb:
    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

    For now, I use "image photo" to scrape(simple ocr) some numbers
    from it, but it only works with Tk.  In the end I want to do
    the processing of the image in the same cron-script that gets
    the screenshot from the phone.

    If nothing else, I'd "convert" (from Imagemagick) the png to
    something I can easier parse in Tcl.

    Hello

    https://wiki.tcl-lang.org/page/Pixane


    via webarchives
    but without source code and no binaries for win 64

    It works with Linux 32 and 64 bit


    Gregor
    Hello,

    a different but current package
    https://github.com/ray2501/tcl-stbimage


    Gregor
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Andreas Leitgeb@avl@logic.at to comp.lang.tcl on Fri Jun 28 22:07:57 2024
    From Newsgroup: comp.lang.tcl

    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.

    That's where I got stuck with each:

    Gerald Lester:
    http://www.graphicsmagick.org/TclMagick/doc/TclMagick.html
    Ted Nolan:
    https://wiki.tcl-lang.org/page/TclMagick

    I got it to configure it
    (--with-magick=/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.11/bin-q16/MagickWand-config)
    compile and install "apparently" successfully, but "package require TclMagick" spews out:
    couldn't load file "/usr/local/lib/TclMagick0.45/libTclMagick.so":
    /usr/local/lib/TclMagick0.45/libTclMagick.so: undefined symbol:
    tclStubsPtr


    Harald Oehlmann:
    https://core.tcl-lang.org/akupries/crimp/home

    I eventually got critcl (from Ubuntu apt) and kettle (from fossil)
    installed. If I try to install crimp, it fails at:
    install-doc-markdown: no files matched glob pattern "*"
    while executing
    "glob -directory $src *"
    I only find the keyword "install-doc-markdown" in kettle's source
    tree, but don't grok it how to just skip that part. Unfortunately,
    the docs are the first thing installed, so as it fails there, nothing
    else gets installed.


    greg:
    https://wiki.tcl-lang.org/page/Pixane

    Thanks for suggesting, but without source - I'll rather not use it.

    greg:
    https://github.com/ray2501/tcl-stbimage

    Seems more targetted towards converting images between formats
    and resizing. According to the web page it doesn't seem like
    supporting extracting rectangular regions from a bigger image
    or any simple access to pixels or rectangles of pixels.


    Paul Obermeier:
    https://github.com/flightaware/tcl.gd

    Extracting rectangles seems covered by "copy", but I didn't
    see (in the docs) any sub command to extract an image's data
    as "list of list of color" - I could query single pixels,
    and I could get it in binary gd/gd2 format, but not sure what
    that is...

    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From ted@loft.tnolan.com (Ted Nolan@tednolan to comp.lang.tcl on Sat Jun 29 05:19:27 2024
    From Newsgroup: comp.lang.tcl

    In article <slrnv7ud1t.3gvbf.avl@logic.at>,
    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.

    That's where I got stuck with each:

    Gerald Lester:
    http://www.graphicsmagick.org/TclMagick/doc/TclMagick.html
    Ted Nolan:
    https://wiki.tcl-lang.org/page/TclMagick

    I got it to configure it

    (--with-magick=/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.11/bin-q16/MagickWand-config)
    compile and install "apparently" successfully, but "package require TclMagick" >spews out:
    couldn't load file "/usr/local/lib/TclMagick0.45/libTclMagick.so":
    /usr/local/lib/TclMagick0.45/libTclMagick.so: undefined symbol:
    tclStubsPtr


    I'm not pushing the package, as all I know about it is that it exists,
    but that sounds like maybe you should link against the stubs library, libtclstub86.a (on my FreeBSD) rather than libtcl86.so/libtcl86.a
    --
    columbiaclosings.com
    What's not in Columbia anymore..
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From greg@gregor.ebbing@gmx.de to comp.lang.tcl on Sat Jun 29 09:35:26 2024
    From Newsgroup: comp.lang.tcl

    Am 29.06.24 um 00:07 schrieb Andreas Leitgeb:
    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.

    That's where I got stuck with each:

    Gerald Lester:
    http://www.graphicsmagick.org/TclMagick/doc/TclMagick.html
    Ted Nolan:
    https://wiki.tcl-lang.org/page/TclMagick

    I got it to configure it
    (--with-magick=/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.11/bin-q16/MagickWand-config)
    compile and install "apparently" successfully, but "package require TclMagick"
    spews out:
    couldn't load file "/usr/local/lib/TclMagick0.45/libTclMagick.so":
    /usr/local/lib/TclMagick0.45/libTclMagick.so: undefined symbol:
    tclStubsPtr


    Harald Oehlmann:
    https://core.tcl-lang.org/akupries/crimp/home

    I eventually got critcl (from Ubuntu apt) and kettle (from fossil) installed. If I try to install crimp, it fails at:
    install-doc-markdown: no files matched glob pattern "*"
    while executing
    "glob -directory $src *"
    I only find the keyword "install-doc-markdown" in kettle's source
    tree, but don't grok it how to just skip that part. Unfortunately,
    the docs are the first thing installed, so as it fails there, nothing
    else gets installed.


    greg:
    https://wiki.tcl-lang.org/page/Pixane

    Thanks for suggesting, but without source - I'll rather not use it.

    greg:
    https://github.com/ray2501/tcl-stbimage

    Seems more targetted towards converting images between formats
    and resizing. According to the web page it doesn't seem like
    supporting extracting rectangular regions from a bigger image
    or any simple access to pixels or rectangles of pixels.


    Paul Obermeier:
    https://github.com/flightaware/tcl.gd

    Extracting rectangles seems covered by "copy", but I didn't
    see (in the docs) any sub command to extract an image's data
    as "list of list of color" - I could query single pixels,
    and I could get it in binary gd/gd2 format, but not sure what
    that is...




    Debian Linux couldn't get it to work with imagemagick.
    wand-config not found

    I switched to graphicsmagick.
    (This also removes imagemagick)
    #tcl-dev and tk-dev are already installed
    apt install graphicsmagick-imagemagick-compat
    apt install graphicsmagick-libmagick-dev-compat

    Downloaded the graphicsmagick source and created the TclMagick
    subdirectory from it

    make
    ./configure
    make install

    (/usr/lib/TclMagick0.46)


    #a example
    #http://www.neatware.com/myrmecox/studio/ex_tclmagick.html


    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Andreas Leitgeb@avl@logic.at to comp.lang.tcl on Sun Jun 30 16:58:00 2024
    From Newsgroup: comp.lang.tcl

    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 ;-)
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Andreas Leitgeb@avl@logic.at to comp.lang.tcl on Sun Jun 30 19:05:02 2024
    From Newsgroup: comp.lang.tcl

    greg <gregor.ebbing@gmx.de> wrote:
    Am 29.06.24 um 00:07 schrieb Andreas Leitgeb:
    http://www.graphicsmagick.org/TclMagick/doc/TclMagick.html
    https://wiki.tcl-lang.org/page/TclMagick

    I got it to configure it
    (--with-magick=/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.11/bin-q16/MagickWand-config)
    compile and install "apparently" successfully, but "package require TclMagick"
    spews out:
    couldn't load file "/usr/local/lib/TclMagick0.45/libTclMagick.so":
    /usr/local/lib/TclMagick0.45/libTclMagick.so: undefined symbol:
    tclStubsPtr

    I gave it another try afterall - with graphicsmagick.

    I switched to graphicsmagick.
    (This also removes imagemagick)
    #tcl-dev and tk-dev are already installed
    apt install graphicsmagick-imagemagick-compat
    apt install graphicsmagick-libmagick-dev-compat

    Ok, did that, too...

    Downloaded the graphicsmagick source and created the TclMagick
    subdirectory from it

    You seem to have found a version 0.46 ...

    The link to sourceforge seems to offer only 0.40 to 0.45 (all
    from year 2005) and their cvs servers seem no longer active
    (connection timeout after about 2 minutes)

    So, please, let me know where you got 0.46 from.


    With 0.45, this is what I get (now with graphicsmagick):

    ./configure

    With those graphicsmagick packages installed, there existed now
    an executable /usr/bin/Wand-config which I had to pass to configure
    as: --with-magick=/usr/bin/Wand-config

    (otherwise, configure would abort with "configure: error: You must
    specify the Graphics/ImageMagick-config script with --with-magick!")

    make install

    build-process emits a big number of warnings, about sign-conversions...
    but it seems to end with success.

    This is the line that creates the dynamic lib:

    gcc -shared .libs/libTclMagick_la-TclMagick.o -L/usr/lib -ldl -lGraphicsMagickWand -lGraphicsMagick -ljbig -lwebp -lwebpmux -lheif
    -lde265 -llcms2 -ltiff -lfreetype -ljpeg -lpng16 -lwmflite -lXext -lSM
    -lICE -lX11 -llzma -lbz2 -lxml2 -lz -lzstd -lm -lpthread -lgomp -Wl,-Bsymbolic-functions -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-soname -Wl,libTclMagick.so.0 -o .libs/libTclMagick.so.0.0.0

    To my surprise, this neither links to stubs nor to any -ltcl at all.

    But still:
    $ tclsh
    % package require TclMagick
    couldn't load file "/usr/local/lib/TclMagick0.45/libTclMagick.so": /usr/local/lib/TclMagick0.45/libTclMagick.so: undefined symbol:
    tclStubsPtr
    %

    I don't see how I could change any linking to stubs...
    Adding --with-tcl=/path/to/tcl8.6.14/unix to configure also didn't
    change anything.

    #a example
    #http://www.neatware.com/myrmecox/studio/ex_tclmagick.html
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From greg@gregor.ebbing@gmx.de to comp.lang.tcl on Sun Jun 30 22:04:48 2024
    From Newsgroup: comp.lang.tcl

    Am 30.06.24 um 21:05 schrieb Andreas Leitgeb:

    So, please, let me know where you got 0.46 from.


    With 0.45, this is what I get (now with graphicsmagick):


    Hello

    First of all:
    the scripts from test work except for

    $wand DrawImage $draw
    #Magick: abort due to signal 11 (SIGSEGV) "Segmentation Fault"...
    #no solution, a bug?


    https://sourceforge.net/projects/graphicsmagick/files/

    Download Latest version
    GraphicsMagick-1.3.43.tar.xz
    in
    GraphicsMagick-1.3.43.tar.xz
    is TclMagick 0.46

    make
    ./configure
    make install
    (/usr/lib/TclMagick0.46)




    package require TclMagick

    set wand [magick create wand]
    if {[catch {$wand ReadImage sample.png} err]} {
    puts "Error reading image: $err"
    exit
    }

    set width 100
    set height 100
    set x 50
    set y 50

    if {[catch {$wand CropImage $width $height $x $y} err]} {
    puts "Error cropping image: $err"
    exit
    }

    if {[catch {$wand WriteImage cropped_sample.png} err]} {
    puts "Error writing cropped image: $err"
    exit
    }

    magick delete $wand
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Christian Gollwitzer@auriocus@gmx.de to comp.lang.tcl on Mon Jul 1 14:19:28 2024
    From Newsgroup: comp.lang.tcl

    Am 30.06.24 um 21:05 schrieb Andreas Leitgeb:
    greg <gregor.ebbing@gmx.de> wrote:
    Am 29.06.24 um 00:07 schrieb Andreas Leitgeb:
    http://www.graphicsmagick.org/TclMagick/doc/TclMagick.html
    https://wiki.tcl-lang.org/page/TclMagick

    I got it to configure it
    (--with-magick=/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.11/bin-q16/MagickWand-config)
    compile and install "apparently" successfully, but "package require TclMagick"
    spews out:
    couldn't load file "/usr/local/lib/TclMagick0.45/libTclMagick.so":
    /usr/local/lib/TclMagick0.45/libTclMagick.so: undefined symbol:
    tclStubsPtr

    I gave it another try afterall - with graphicsmagick.

    I switched to graphicsmagick.
    (This also removes imagemagick)
    #tcl-dev and tk-dev are already installed
    apt install graphicsmagick-imagemagick-compat
    apt install graphicsmagick-libmagick-dev-compat

    Ok, did that, too...

    Downloaded the graphicsmagick source and created the TclMagick
    subdirectory from it

    You seem to have found a version 0.46 ...

    The link to sourceforge seems to offer only 0.40 to 0.45 (all
    from year 2005) and their cvs servers seem no longer active
    (connection timeout after about 2 minutes)

    So, please, let me know where you got 0.46 from.


    With 0.45, this is what I get (now with graphicsmagick):

    ./configure

    With those graphicsmagick packages installed, there existed now
    an executable /usr/bin/Wand-config which I had to pass to configure
    as: --with-magick=/usr/bin/Wand-config

    (otherwise, configure would abort with "configure: error: You must
    specify the Graphics/ImageMagick-config script with --with-magick!")

    make install

    build-process emits a big number of warnings, about sign-conversions...
    but it seems to end with success.

    This is the line that creates the dynamic lib:

    gcc -shared .libs/libTclMagick_la-TclMagick.o -L/usr/lib -ldl -lGraphicsMagickWand -lGraphicsMagick -ljbig -lwebp -lwebpmux -lheif
    -lde265 -llcms2 -ltiff -lfreetype -ljpeg -lpng16 -lwmflite -lXext -lSM
    -lICE -lX11 -llzma -lbz2 -lxml2 -lz -lzstd -lm -lpthread -lgomp -Wl,-Bsymbolic-functions -Wl,-z -Wl,relro -Wl,-z -Wl,now -Wl,-soname -Wl,libTclMagick.so.0 -o .libs/libTclMagick.so.0.0.0

    To my surprise, this neither links to stubs nor to any -ltcl at all.

    that seems to be the issue. Te good news is that if tclStubsPtr is
    undefined, it is indeed compiled against the stubs version. SO simply relinking with the stubs linb should do.

    But still:
    $ tclsh
    % package require TclMagick
    couldn't load file "/usr/local/lib/TclMagick0.45/libTclMagick.so": /usr/local/lib/TclMagick0.45/libTclMagick.so: undefined symbol:
    tclStubsPtr
    %

    Expected

    I don't see how I could change any linking to stubs...
    Adding --with-tcl=/path/to/tcl8.6.14/unix to configure also didn't
    change anything.

    You can force-add a linker line to configure, usually like this:

    LIBS="-ltclstub8.5" LDFLAGS="-L<path_to_tclstub>" ./configure ...yourotheroptions....

    If you need to tweak the LIBS and LDFLAGS this should bail out early
    when trying to compile test programs.

    Christian





    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Andreas Leitgeb@avl@logic.at to comp.lang.tcl on Mon Jul 1 17:55:39 2024
    From Newsgroup: comp.lang.tcl

    greg <gregor.ebbing@gmx.de> wrote:
    Am 30.06.24 um 21:05 schrieb Andreas Leitgeb:
    So, please, let me know where you got 0.46 from.
    https://sourceforge.net/projects/graphicsmagick/files/

    Download Latest version
    GraphicsMagick-1.3.43.tar.xz
    in
    GraphicsMagick-1.3.43.tar.xz
    is TclMagick 0.46

    Thanks, now I got it :-)

    make
    ./configure
    make install
    (/usr/lib/TclMagick0.46)

    package require TclMagick

    I got this too, now, so it seems like the stubs-thing was
    fixed in this 0.46 :-)

    set wand [magick create wand]

    Yes, the extension seems to work in principle, but it seems
    like graphicsmagick dropped the "-copy" feature from "convert",
    which I'd have had good use for... Also I got it into seg-
    faults a couple of times, as well, but maybe my commands were
    just bad.

    Querying "pixels" just didn't do anything visible with an
    empty "map"-argument, and segfaulted with whatever else I
    tried for that argument. Maybe I read the docs not well enough..

    My current solution involves "-copy" to copy certain "far-off"
    parts of the image into a more central part, then only convert
    the smaller region around the central parts to bmp3 format.

    I might try this TclMagick 0.46 with original imagemagick,
    to see if that gives me a "copy" subcommand for $wand.

    And I've yet to study the docs better to see how "pixel" is
    really to be used.

    Thanks 2 all!
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From greg@gregor.ebbing@gmx.de to comp.lang.tcl on Wed Jul 3 00:21:20 2024
    From Newsgroup: comp.lang.tcl

    Am 01.07.24 um 19:55 schrieb Andreas Leitgeb:
    greg <gregor.ebbing@gmx.de> wrote:
    Am 30.06.24 um 21:05 schrieb Andreas Leitgeb:
    So, please, let me know where you got 0.46 from.
    https://sourceforge.net/projects/graphicsmagick/files/

    Download Latest version
    GraphicsMagick-1.3.43.tar.xz
    in
    GraphicsMagick-1.3.43.tar.xz
    is TclMagick 0.46

    Thanks, now I got it :-)

    make
    ./configure
    make install
    (/usr/lib/TclMagick0.46)

    package require TclMagick

    I got this too, now, so it seems like the stubs-thing was
    fixed in this 0.46 :-)

    set wand [magick create wand]

    Yes, the extension seems to work in principle, but it seems
    like graphicsmagick dropped the "-copy" feature from "convert",
    which I'd have had good use for... Also I got it into seg-
    faults a couple of times, as well, but maybe my commands were
    just bad.

    Querying "pixels" just didn't do anything visible with an
    empty "map"-argument, and segfaulted with whatever else I
    tried for that argument. Maybe I read the docs not well enough..

    My current solution involves "-copy" to copy certain "far-off"
    parts of the image into a more central part, then only convert
    the smaller region around the central parts to bmp3 format.

    I might try this TclMagick 0.46 with original imagemagick,
    to see if that gives me a "copy" subcommand for $wand.

    And I've yet to study the docs better to see how "pixel" is
    really to be used.

    Thanks 2 all!

    # bißchen rumprobiert
    # setPixel
    # parts of it from TclMagick/tests
    set width 100
    set height 100
    set x 50
    set y 50

    # new blank picture
    # xc:$color" from
    # http://www.graphicsmagick.org/formats.html
    set wand [magick create wand]
    set color white
    $wand ReadImage "xc:$color"
    $wand ResizeImage $width $height cubic

    # Create the binary data for red pixels
    # Each pixel requires 3 bytes (RGB), 80x10 pixels
    set red_pixel_data [string repeat [binary format c* {255 0 0}] [expr
    80 * 10]]
    $wand SetPixels 0 0 80 10 "RGB" char $red_pixel_data
    $wand WriteImage empty-wr1.png

    # GetPixel
    set extracted_pixels [$wand GetPixels 10 5 80 10 "RGB" char]
    # Paste the extracted region to a new location
    $wand SetPixels 20 30 80 10 "RGB" char $extracted_pixels
    $wand WriteImage empty-wr2.png

    set pixel_color [$wand GetPixels 15 7 1 1 "RGB" char]
    binary scan $pixel_color c* rgb_values
    set red [lindex $rgb_values 0]
    set green [lindex $rgb_values 1]
    set blue [lindex $rgb_values 2]
    puts "Color of pixel at (15, 7): red=$red, green=$green, blue=$blue"

    magick delete $wand

    # copy with clone?
    # set cwand [$wand clone]
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Andreas Leitgeb@avl@logic.at to comp.lang.tcl on Wed Jul 3 16:53:15 2024
    From Newsgroup: comp.lang.tcl

    A big THANK YOU!!

    greg <gregor.ebbing@gmx.de> wrote:
    Querying "pixels" just didn't do anything visible with an
    empty "map"-argument, and segfaulted with whatever else I
    tried for that argument. Maybe I read the docs not well enough..

    set extracted_pixels [$wand GetPixels 10 5 80 10 "RGB" char]

    This was the key...

    Seeing "GetPixels" at work got me trying again...

    I now just load the original pic into (GraphicsMagick-powered)
    TclMagick0.46 and use GetPixels for the rectangles I need to
    examine...

    and it became like *5 times faster* than my previous approach
    with calling "convert" and parsing it's output. :-)

    --- Synchronet 3.20a-Linux NewsLink 1.114