Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: greg Newsgroups: comp.lang.tcl Subject: Re: is there an image package that doesn't require Tk ? Date: Wed, 3 Jul 2024 00:21:20 +0200 Organization: A noiseless patient Spider Lines: 88 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Wed, 03 Jul 2024 00:21:21 +0200 (CEST) Injection-Info: dont-email.me; posting-host="e4c2fc55b3de6a6dea2a22b74448d4a0"; logging-data="1919021"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19p8tDjvXpAzCFappKLhj3G6jfqMsiB3Mo=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:bIQiJDz47zaPsrQW/aV6p7vXlQM= In-Reply-To: Content-Language: de-DE Bytes: 3921 Am 01.07.24 um 19:55 schrieb Andreas Leitgeb: > greg 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]