Didactic RGB

Discussion of challenges you have already solved
Pai Mei
Posts: 1
Joined: Sun Jun 21, 2009 6:54 pm

Didactic RGB

Post by Pai Mei »

first i downloaded the graphic (the pixel) and opened it with paint. then i checked the rgb-value, calculated and got a wrong result.
then i copied the graphic and pasted it into paint. then i checked the rgb-value and it was slightly different (two of the three color values were decreased by 1). this second value led me to the right answer.

how come there is this difference?
User avatar
SinistraD
Posts: 89
Joined: Sun Aug 16, 2009 8:39 am
Location: find me
Contact:

Post by SinistraD »

I haven't had such a problem, but how do you get the rgb value of a pixel in Paint? I used GIMP, but Paint is always easier to attain for trivial tasks (like this).
User avatar
sabretooth
Posts: 61
Joined: Sun Jul 12, 2009 3:13 pm

Post by sabretooth »

SinistraD wrote:I haven't had such a problem, but how do you get the rgb value of a pixel in Paint? I used GIMP, but Paint is always easier to attain for trivial tasks (like this).
use the eyedropper tool to select you colour then do to the 'colors' menu 'edit colors' click the 'define custom colors' button. Voila. RGB in decimal :)

hope that helps.

sabre
User avatar
SinistraD
Posts: 89
Joined: Sun Aug 16, 2009 8:39 am
Location: find me
Contact:

Post by SinistraD »

Thanks for the reply, never tried this way so far. I went that far to get the color with the "eyedropper", than I tried to obtain the RGB in the color toolbox.
TechnoDemon
Posts: 20
Joined: Tue Apr 13, 2010 7:48 am
Location: Makassar, ID

Post by TechnoDemon »

i used pixlr for this challenge cause i've used to use photoshop but my license for it have been missing (i have formatted my hdd n when i try to reinstal the photoshop, the dvd-case is missing)*. Pixlr is similar to photoshop but one different: FREE TO USE!!!

*i really dislike using a cracked software. I hate it!
No Pain = Gain
That's how programmer develops...
zahnstein
Posts: 1
Joined: Sun Oct 17, 2010 4:00 pm

Post by zahnstein »

Had the same problem, paintbrush gave wrong values.
Tip: Use GIMP
Silly Freak
Posts: 1
Joined: Fri Oct 22, 2010 12:02 pm
Contact:

Post by Silly Freak »

I used gimp under linux (rightclick/copy graphics, paste in gimp) but got the wrong value 10376136. then I checked on a friend's computer under windows, and the value was slightly off... how that?
User avatar
MyNameIsAlreadyTaken
Posts: 31
Joined: Sun Oct 17, 2010 10:21 am
Location: Germany

Post by MyNameIsAlreadyTaken »

I'm using Linux (Ubuntu 10.10 64Bit) and Gimp too, I had no problem in getting the right value.


Maybe copying the Image was a bad idea, try again with rightclick -> save as
rmplpmpl
Posts: 113
Joined: Sun Oct 26, 2008 10:38 am
Location: Germany

Post by rmplpmpl »

You encounter this problem, if the browser renders the picture, actually I do not understand why they do so, but you often see strange colors when comparing a picture in browser view compared to the "raw" pic
megabreit
Posts: 141
Joined: Sat Jan 03, 2009 3:33 pm

Post by megabreit »

It's probably because monitor color profiles and gamma correction change the output to be more "natural"... but this also means it's not "accurate" anymore.
BTW: This is OS independent :-)
rmplpmpl
Posts: 113
Joined: Sun Oct 26, 2008 10:38 am
Location: Germany

Post by rmplpmpl »

megabreit wrote:It's probably because monitor color profiles and gamma correction change the output to be more "natural"... but this also means it's not "accurate" anymore.
BTW: This is OS independent :-)
Maybe, though it is strange: take wikipedia f.i. look at any picture, then click on it until you get only the picture displayed in the browser (not embedded in HTML) and you will get different colors, so I guess it has something to do with the browser. Monitor profiles would affect this as well, wouldn't they?
megabreit
Posts: 141
Joined: Sat Jan 03, 2009 3:33 pm

Post by megabreit »

rmplpmpl wrote: Maybe, though it is strange: take wikipedia f.i. look at any picture, then click on it until you get only the picture displayed in the browser (not embedded in HTML) and you will get different colors, so I guess it has something to do with the browser. Monitor profiles would affect this as well, wouldn't they?
To be honest, I don't really know if it works like that. It's also possible, that the application may decide to honor color profiles or simply work with raw values. E.g. in Firefox there is a config option gfx.color_management.mode (see in about:config). Does the behavior change if you choose different values?
wynk
Posts: 7
Joined: Tue Jan 03, 2012 7:59 pm

Post by wynk »

My tiny ruby solution:

Code: Select all

require 'rubygems'
require 'chunky_png'
image = ChunkyPNG::Image.from_file('didactrgb.png')
color = ChunkyPNG::Color.to_truecolor_bytes(image[0,0])
color.map! { |x| x.to_s(2).rjust(8, '0') }
puts color.join.to_i(2)
DragonEgghead
Posts: 3
Joined: Wed May 02, 2012 7:50 pm

Post by DragonEgghead »

Step 1: Get the RGB value from MSPaint (as described by others).
Step 2: Plug in values to my script from before:

Code: Select all

int(''.join("%08d"%int(bin(i)[2:]) for i in [156, 84, 198]),2)
255 character limit for signatures. Almost enough to display each ASCII character exactly twice (if all characters printed). One less than enough to display every character in ANSI exactly once (again, if all printed). Also, the number of characters here.
AgRaven
Posts: 13
Joined: Sun Feb 24, 2013 8:27 am

Post by AgRaven »

I found some research on png files helped explain why the colours were distorted. My solution was definitely roundabout, could have done it much simpler, but still, explains thecolour issues.
Post Reply