Page 1 of 1

Getting pixel color from bitmap with Ruby

Posted: Fri May 14, 2021 5:04 pm
by adamszabo
Hey Guys, I am wondering is there some hidden function that can get the color values of a pixel in a bitmap at a specific coordinate? There is the GetPixel primitive which can be used, but I hoped to use ruby for it. I was thinking something like @bitmap.getARGB(12,23) but that ofcourse didnt work :cry:

Re: Getting pixel color from bitmap with Ruby

Posted: Fri May 14, 2021 5:39 pm
by aronb
See this (my) post: http://www.dsprobotics.com/support/viewtopic.php?f=2&t=14697

Still no real way that I have found, but I am no RUBY expert, that's for sure :lol:

Trog has some REALLY good info in the post though! :ugeek:


Aron

Re: Getting pixel color from bitmap with Ruby

Posted: Sat Apr 29, 2023 9:15 am
by Alisha78
hello everyone,
To get the pixel color from a bitmap using Ruby, you can use the ChunkyPNG library's Color module. This module provides various methods to extract color information from a PNG image, including the from_rgba method that returns the red, green, blue, and alpha values of a pixel at a given coordinate.

Re: Getting pixel color from bitmap with Ruby

Posted: Sun Apr 30, 2023 1:08 pm
by R&R
Yay!
Bots using chatGPT to spam using years old posts... Gr8 :roll:

Re: Getting pixel color from bitmap with Ruby

Posted: Mon May 01, 2023 8:34 am
by Spogg
R&R wrote:Yay!
Bots using chatGPT to spam using years old posts... Gr8 :roll:
Oh dear! :oops:

That one got past me, but I’ll leave it in place as an example. Thanks for pointing it out and if it happens again maybe you can let me know…
It was clever because it seemed to fit the topic and my knowledge of Ruby is very limited.

I’ll remove the link though.

Re: Getting pixel color from bitmap with Ruby

Posted: Mon May 01, 2023 9:49 am
by adamszabo
Haha, a good way to gage if its a bot is to check the registration date and the first post date:

Joined: Sat Apr 29, 2023 10:14 am
1st Post: Sat Apr 29, 2023 10:15 am

Only after 1 minute they post...seems like 100% bot :lol: Usually a real person checks around the topics and browses a little before posting

Re: Getting pixel color from bitmap with Ruby

Posted: Mon May 01, 2023 10:32 am
by R&R
The web is infested :lol:
All the API's for AI chats isn't going to make this any better in the future :roll:

Re: Getting pixel color from bitmap with Ruby

Posted: Mon May 01, 2023 11:14 am
by Spogg
Good points. I may get caught again, but at least I’m wise to it now.

I think my best approach, if in doubt, would be to ask a question before I allow the post to appear. No sensible answer and it doesn’t get posted.

Re: Getting pixel color from bitmap with Ruby

Posted: Mon May 01, 2023 1:53 pm
by R&R
Shoot first ask questions later? ;) :mrgreen:

If I start posting any type of assembler code "that works", then you know my account has been stolen by Skynet ;) nuke it :lol: