Getting pixel color from bitmap with Ruby

For general discussion related FlowStone
Post Reply
adamszabo
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Getting pixel color from bitmap with Ruby

Post 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:
User avatar
aronb
Posts: 154
Joined: Sun Apr 17, 2011 3:08 am
Location: Florida, USA
Contact:

Re: Getting pixel color from bitmap with Ruby

Post 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
Alisha78
Posts: 1
Joined: Sat Apr 29, 2023 9:14 am

Re: Getting pixel color from bitmap with Ruby

Post 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.
R&R
Posts: 474
Joined: Fri Jul 15, 2022 2:28 pm
Contact:

Re: Getting pixel color from bitmap with Ruby

Post by R&R »

Yay!
Bots using chatGPT to spam using years old posts... Gr8 :roll:
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Getting pixel color from bitmap with Ruby

Post 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.
adamszabo
Posts: 667
Joined: Sun Jul 11, 2010 7:21 am

Re: Getting pixel color from bitmap with Ruby

Post 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
R&R
Posts: 474
Joined: Fri Jul 15, 2022 2:28 pm
Contact:

Re: Getting pixel color from bitmap with Ruby

Post 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:
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: Getting pixel color from bitmap with Ruby

Post 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.
R&R
Posts: 474
Joined: Fri Jul 15, 2022 2:28 pm
Contact:

Re: Getting pixel color from bitmap with Ruby

Post 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:
Post Reply