Skip to first unread message

gius

unread,
Apr 22, 2017, 7:47:16 AM4/22/17
to MIT App Inventor Forum
Hello to all,
It is possible coloring all pixels 82, 65, 114 (RGB), with another color?

thanks

Italo

unread,
Apr 22, 2017, 8:27:27 AM4/22/17
to MIT App Inventor Forum
It's possible, but extremely slow in App Inventor 2. Depending on your screen resolution and device speed, it may take more than a minute to check all the pixels for the color you want to replace.

SteveJG

unread,
Apr 22, 2017, 9:26:18 AM4/22/17
to mitappinv...@googlegroups.com
Changing pixels using App Inventor blocks is extremely slow as Italo points out.  Actually, this could take much longer than a minute depending on the image size.

What you want to do MIGHT be more rapid and possible using a javascript.   The work  would have to be done in a WebViewer ...this link might help  https://www.w3schools.com/tags/canvas_getimagedata.asp   .    I have not tried this. The code would have to be modified for use with AI2.



Regards,
Steve

gius

unread,
Apr 22, 2017, 12:06:49 PM4/22/17
to MIT App Inventor Forum
Thanks Italo and Steve for your Answers.
I would also like to try it.

Any advice on the blocks over WebViewer?
Is there any block AI2 that I can look at?

thank you

Italo

unread,
Apr 22, 2017, 2:30:35 PM4/22/17
to mitappinv...@googlegroups.com
If you want to try the App Inventor side,
Do you know how to use FOR EACH loops?
If you do, create two nested FOR EACH loops, one for the line (y) and the other for the column (x)
Then check each position the loops give you for the color you want to replace. If that x,y = the color you are looking for, draw a pixel in that same position with the new color.

If you don't know how to do that, please learn more basic App Inventor 2 things before trying to do more advanced things.


I don't know anything about JavaScript, so I can't help with that.

Taifun

unread,
Apr 22, 2017, 2:49:03 PM4/22/17
to MIT App Inventor Forum
It is possible coloring all pixels 82, 65, 114 (RGB), with another color?
probably Mika's Image Editor extension offers a method you could use?

Taifun

Italo

unread,
Apr 22, 2017, 3:16:38 PM4/22/17
to MIT App Inventor Forum
Wow, I haven't seen those new extensions. Thanks Taifun.

Reply all
Reply to author
Forward
0 new messages