Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > alt.os.linux > #57300
| From | owl <owl@rooftop.invalid> |
|---|---|
| Newsgroups | alt.os.linux |
| Subject | Re: reading / writing the color of an absolute pixel (x,y) of the physical screen |
| Date | 2019-06-27 13:53 +0000 |
| Organization | O.W.L. |
| Message-ID | <da888q3q.t3qut3q@rooftop.invalid> (permalink) |
| References | (6 earlier) <qevssk$l6u$3@dont-email.me> <s8z0b8803tag.au4@rooftop.invalid> <qf0fdj$6pp$2@dont-email.me> <szv803ga.3ghui@rooftop.invalid> <qf25lp$1mv$1@dont-email.me> |
Soviet_Mario <SovietMario@cccp.mir> wrote:
> On 27/06/19 01:05, owl wrote:
>> Soviet_Mario <SovietMario@cccp.mir> wrote:
>>> On 26/06/19 16:00, owl wrote:
>>>> Soviet_Mario <SovietMario@cccp.mir> wrote:
>>>>> On 26/06/19 14:35, owl wrote:
>>>>>> Soviet_Mario <SovietMario@cccp.mir> wrote:
>>>>>>> On 26/06/19 10:37, F. Russell wrote:
>>>>>>>> On Wed, 26 Jun 2019 01:13:47 +0200, Soviet_Mario wrote:
>>>>>>>>
>>>>>
>>>>> very kind ! I'll have a look if I don't get the native
>>>>> Gambas way to work
>>>>> Tnx
>>>>>
>>>>
>>>> xdotool helps a lot with x11 automation stuff:
>>>> This will give you color for a pixel at x y:
>>>> e.g. ./pixelcolor 100 300
>>>>
>>>> #!/bin/bash
>>>> (xdotool mousemove ${1} ${2}; xdotool click 1) |grabc
>>>>
>>>>
>>>> This will capture a rectangle x1 y1 x2 y2 to /tmp/out.png:
>>>> e.g. ./rectcapture 110 212 373 400
>>>>
>>>> #!/bin/bash
>>>> (xdotool mousemove ${1} ${2}
>>>> xdotool mousedown 1;
>>>> xdotool mousemove ${3} ${4}
>>>> xdotool mouseup 1) |scrot -s /tmp/out.png
>>>>
>>>>
>>>
>>> I would prefer to avoid both "shelling" and inter-processes
>>> switching if not strictly inevitable and/or if done rarely
>>> at big chunks at a time.
>>> One thing is to just load a library once at startup and then
>>> call its APIs, another is using multiple times (millions of
>>> times) cli commands.
>>>
>>
>> You said you're not doing video graphics,
>
> well, not in the sense to make animation or mass batch
> processing, apply multiple effects or so to many pictures
> ... but a reasonable speed is required.
> Say I want to mask and watermark a 2000x1000 pixel, it'd be
> always 2000000 millions calls. An interprocess approach to a
> console utility is out of question.
> I can't even use the high level gambas native functions on
> bitmaps, I just used them once at load and once at transfer
> of finished outcome
>
>> so why would you need to
>> get a rectangle millions of times? If you're wanting to get the
>> pixels individually, look at the grabc source code.
>>
>> https://github.com/immunant/grabc/blob/master/grabc.c
>
> Thanks .... anyway as I said elsewhere, I discovered a
> "renamed" function called Desktop.Screenshot (native to
> gambas) that is lightening and supports any rectangle of the
> current screen).
>
> Now i'm up to finding a way to also transfer the content to
> a DrawingArea or other container. I find the approach
> unfamiliar (and have to understand the difference of
> management among "dynamic" graphics, which are implemented
> via IMAGE object, and managed internally, and "static"
> graphics, impl. via PICTURE object, and said to be
> transfered to X server internal buffers : I have confused
> ideas on this multiple layer approach and thus getting
> strange results, like output that is permanent : can be
> saved on files but do not show up anywhere, and output that
> is visible but is not redrawn when a part of the window is
> covered and re-exposed).
>
> But I don't mean to annoy the NG with these problems, as are
> no longer general linux-related.
> I had tried a wrong way to bypass "impasse" (and you all
> gave kind advices).
> But I still have more general problem comprehension about
> the whole graphics model of Gambas (which replicates
> somewhat the philosophy of server X).
>
> I didn't mean to submit general programming issues, I'm
> often OT enough ! :)
>
You might also consider looking into the perl Image::Imlib2
interface. Reading all pixels from a screenshot of my desktop
(1600x900) took about 2.6 seconds:
anon@lowtide:~/code/imlib2$ time ./doit >data
real 0m2.580s
user 0m2.532s
sys 0m0.044s
anon@lowtide:~/code/imlib2$ wc -l data
1440000 data
anon@lowtide:~/code/imlib2$ head data
x,y: 0,0 r: 223 g: 111 b: 0 a: 255
x,y: 0,1 r: 192 g: 95 b: 0 a: 255
x,y: 0,2 r: 192 g: 95 b: 0 a: 255
x,y: 0,3 r: 192 g: 95 b: 0 a: 255
x,y: 0,4 r: 192 g: 95 b: 1 a: 255
x,y: 0,5 r: 192 g: 95 b: 1 a: 255
x,y: 0,6 r: 192 g: 95 b: 0 a: 255
x,y: 0,7 r: 192 g: 95 b: 0 a: 255
x,y: 0,8 r: 192 g: 95 b: 0 a: 255
x,y: 0,9 r: 192 g: 95 b: 0 a: 255
anon@lowtide:~/code/imlib2$ tail data
x,y: 1599,890 r: 157 g: 152 b: 149 a: 255
x,y: 1599,891 r: 156 g: 151 b: 148 a: 255
x,y: 1599,892 r: 156 g: 151 b: 147 a: 255
x,y: 1599,893 r: 155 g: 150 b: 146 a: 255
x,y: 1599,894 r: 156 g: 151 b: 148 a: 255
x,y: 1599,895 r: 155 g: 150 b: 147 a: 255
x,y: 1599,896 r: 156 g: 148 b: 146 a: 255
x,y: 1599,897 r: 157 g: 149 b: 147 a: 255
x,y: 1599,898 r: 157 g: 149 b: 147 a: 255
x,y: 1599,899 r: 156 g: 148 b: 146 a: 255
anon@lowtide:~/code/imlib2$
https://manpages.debian.org/stretch/libimage-imlib2-perl/Image::Imlib2.3pm.en.html
Back to alt.os.linux | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
reading / writing the color of an absolute pixel (x,y) of the physical screen Soviet_Mario <SovietMario@CCCP.MIR> - 2019-06-25 17:53 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Alfonso P Cutaway <dweed54@gmail.com> - 2019-06-25 16:01 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen "R.Wieser" <address@not.available> - 2019-06-25 19:03 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Alfonso P Cutaway <dweed54@gmail.com> - 2019-06-25 18:08 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen "R.Wieser" <address@not.available> - 2019-06-25 21:44 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Alfonso P Cutaway <dweed54@gmail.com> - 2019-06-26 00:37 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen "R.Wieser" <address@not.available> - 2019-06-26 10:50 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Alfonso P Cutaway <dweed54@gmail.com> - 2019-06-26 19:43 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen "Carlos E.R." <robin_listas@es.invalid> - 2019-06-26 22:37 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Alfonso P Cutaway <dweed54@gmail.com> - 2019-06-26 20:55 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen "Carlos E.R." <robin_listas@es.invalid> - 2019-06-26 23:29 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Aragorn <thorongil@telenet.be> - 2019-06-26 23:50 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Alfonso P Cutaway <dweed54@gmail.com> - 2019-06-26 22:50 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen DecadentLinuxUserNumeroUno@decadence.org - 2019-06-28 12:50 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen DecadentLinuxUserNumeroUno@decadence.org - 2019-06-28 12:56 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen "R.Wieser" <address@not.available> - 2019-06-27 11:10 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Soviet_Mario <SovietMario@CCCP.MIR> - 2019-06-27 12:39 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen "R.Wieser" <address@not.available> - 2019-06-27 14:43 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Soviet_Mario <SovietMario@CCCP.MIR> - 2019-06-27 15:57 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Soviet_Mario <SovietMario@CCCP.MIR> - 2019-06-26 01:03 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Alfonso P Cutaway <dweed54@gmail.com> - 2019-06-26 00:38 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Wildman <best_lay@yahoo.com> - 2019-06-25 11:18 -0500
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Soviet_Mario <SovietMario@CCCP.MIR> - 2019-06-26 01:02 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Aragorn <thorongil@telenet.be> - 2019-06-26 01:08 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Bit Twister <BitTwister@mouse-potato.com> - 2019-06-25 11:48 -0500
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Paul <nospam@needed.invalid> - 2019-06-25 16:14 -0400
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Soviet_Mario <SovietMario@CCCP.MIR> - 2019-06-26 01:13 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen "F. Russell" <fr@random.info> - 2019-06-26 08:37 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Soviet_Mario <SovietMario@CCCP.MIR> - 2019-06-26 12:29 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Bit Twister <BitTwister@mouse-potato.com> - 2019-06-26 06:55 -0500
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen "F. Russell" <frussell@random.info> - 2019-06-26 12:15 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen owl <owl@rooftop.invalid> - 2019-06-26 12:35 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Soviet_Mario <SovietMario@CCCP.MIR> - 2019-06-26 15:44 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen owl <owl@rooftop.invalid> - 2019-06-26 14:00 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Soviet_Mario <SovietMario@CCCP.MIR> - 2019-06-26 21:01 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen owl <owl@rooftop.invalid> - 2019-06-26 23:05 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Soviet_Mario <SovietMario@CCCP.MIR> - 2019-06-27 12:27 +0200
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen owl <owl@rooftop.invalid> - 2019-06-27 13:53 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Jasen Betts <jasen@xnet.co.nz> - 2019-06-26 10:13 +0000
Re: reading / writing the color of an absolute pixel (x,y) of the physical screen Soviet_Mario <SovietMario@CCCP.MIR> - 2019-06-26 12:49 +0200
csiph-web