ABG
September 12, 2024, 12:51am
2
The 4th value you get from a Split Color block is not Yellow.
It's a measure of how opaque or transparent that color is.
(I forget the name. It's probably in the tool tip for that block.)
Well, that helped a lot.
At least we know now it's not Yellow.
I might be wrong as to its purpose.
It might be a measure of light or dark.
I have played PC games where you get to tune the game by viewing a dark scene and sliding a bar to set alpha, to control the video contrast.
ABG
September 12, 2024, 1:00am
4
Let's look at the Canvas blocks.
Notice how there are two different blocks to get pixel color.
I see you loaded a photo onto the Canvas background but are asking for the foreground (drawn) pixel colors.
That might explain the constant 255 value?
I already noticed and fixed that. Thanks. Its for a science project.
ABG
September 12, 2024, 1:01am
6
So, does it work now?
I don't play with that much.
No. I still can't figure it out.
I looked it up and its how saturated the image is.
ABG
September 12, 2024, 1:05am
9
Can you ignore the 4th value and still get the project to work?
If not, there is a Canvas attribute, background color, if I recall, that you might have to adjust to let the background image show properly.
You would have to set the background color to transparent or None, if there is such a thing.
(I have not used this.)
P.S. I found it, and it can be switched from Default to None.
Don't know if it helps, though.
My app detects color. I think it only does red, green, and blue.
Also background of canvas does not help. Thanks, though
It said how to extract colors. It said to use Get background pixel color instead of just pixel color. Works the same. Didn't fix it, huh.
ABG
September 12, 2024, 1:25am
16
I found the Canvas doc at
https://ai2.appinventor.mit.edu/reference/components/animation.html#Canvas
If you want to go down the base64 rabbit hole, there is a block to convert an image to base64 text. From there, you would need to know how the photo image is encoded in bits and bytes, and how to convert back and forth to base64.
That constant 255 luminance value might just be the fact that pictures don't glow in the dark?
Do you really really need that luminance?
ABG
September 12, 2024, 1:51am
17
Since this is for a science class, you will need to know some color theory.
RGB colour model, a structured system used in digital devices and light-based media to create a gamut of colours from a small set of primary colours—in this case, red, green, and blue (the name of the colour model comes from the first letter of each...
The RGB color model is an additive color model in which the red, green and blue primary colors of light are added together in various ways to reproduce a broad array of colors. The name of the model comes from the initials of the three additive primary colors, red, green, and blue.
The main purpose of the RGB color model is for the sensing, representation, and display of images in electronic systems, such as televisions and computers, though it has also been used in conventional photography an...
The section on cameras and colors explains why there are only three components from your camera, not 4.
TIMAI2
September 12, 2024, 7:30am
18
The word I believe @ABG was looking for is opacity
If the alpha channel is returning 255, then in terms of RGB you can ignore it, and just use the first three values. If it is less than 255 then you would need to report in RGBA.
2 Likes
ABG
September 12, 2024, 11:25am
19
I totally forgot about opacity.
That's for letting you see through overlapping Sprites.
By now, you should have lots of color knowledge to impress your science class
ABG
September 12, 2024, 3:06pm
20
Here's little project to play with opacity:
canvas_opacity.aia (4.2 KB)