Inspect pixel color on screen - android

I would like to determine the color of something on my screen that is part of my app, such as the background color of an activity. The only solution I can think of is to take a snapshot of the screen and then inspect it with a graphics app. Is there something built into Android or Android Studio that lets me inspect the color of something on the screen to determine it's RGB value?
NOTE: This is strictly for debugging my app. I don't need something to integrate into my app. I need a tool to verify what the colors are on screen.

Try this lib to obtain color from view in RGB ("#" + envelope.getHexCode()): https://github.com/skydoves/ColorPickerView

Related

UI Automator - Get background color at XY coordinates

Is there a way to get the color of the exact place on-screen using UI Automator?
Real case problem: some button changes the screen background color. I need to reach background property somehow using UI Automator. Searching in documentation and source code didn't bring any results.
Some workarounds and hacks acceptable.
You can convert your view to bitmap using this Question
Then on the Bitmap call getPixel(x,y) and get the Color of the pixel on that position.
int pixel = bitmap.getPixel(100,100);
Color color = Color.valueOf(pixel);
color.alpha();
color.red();
color.green();
color.blue();
I saw a video of a YouTuber who used python to read RGB values from points on the screen of his monitor in real time.
https://youtu.be/aosN_FvW2e4
Python outputs values to the console though, so you can only use this to test your app on an emulator

Change pixel color in android display

I want to change pixel color via android application using background.
It means entire screen, not image file.
How can I modify pixel color?
Result of searching, I could find "Bitmap", "Surfaceflinger", "Framebuffer".
but, I don't know what is correct way.
The concept SurfaceFlinger and Framebuffer is a low level concept in Android system. In application level, which built on framework, these concepts are opaque.
As Bitmap, it's not very necessary if you just change the background color.
You can just simply do like following in your Activity.
getWindow().setBackgroundDrawableResource(R.color.color_res_id);
// or change the root view background
getWindow().getDecorView().setBackgroundResource(R.color.color_res_id);
If you are novice in Android app development, you can start reading the training here, it's a good source for beginner to start.

How can I get rid of transparent background space in (Android Asset Studio - Icon Generator)?

When I upload my image (which has no background to begin with), it is automatically given transparent background no matter what settings I choose. I really like the "Square" shape (rounded corners) but there is way too much excess transparent background. When I see the icon on my phone it looks so small compared to Facebook for example. How can I get rid of this extra background space to make it as large as possible? Is one of my settings off?
http://reiszecke.github.io/AndroidAssetStudioFullsize/
Just click on >> Launcher icons << Full Size edit
pls mark as answer if it helped.
EDIT: only works on "bevel" and "none", I will adjust the other shapes at some point
http://www.gieson.com/Library/projects/utilities/icon_slayer/
Does the job but the an image must be provided first.
Creating the logo and background with LIG and loading the result in the gieson's icon_slayer should do it.

Color issues from photoshop to android

I have created some images and set some colors using photoshop and applied them to our app in android studio, but for the same hex code, colors arent same, I do not understand why this is happening. I took a screen shot of the color im working in photoshop and then opened the image in photoshop, surprisingly the color code changed, and it was same as android studio was showing and its not the actual color, I have even checked the RGB/ CMYK mode, it is in RGB mode, i even tried CMYK mode, in the both the cases the problem persists. No matter how many times i have tried, the problem persists. Please help me out
I agree with Rodrigo, you should set a color workflow.
If you are mainly working on documents viewed on the web or mobile devices :
1) in Photoshop go to Edit>Colors Settings and set your RGB Colorspace to "sRGB".
2) Make sure Proof Colors is unchecked in the View menu.
3) Make sure your document has the "sRGB" color profile attributed (can be fixed by using "Attribute color profile" or "Convert color profile" in the Edit menu).
This should ensure color consistency across most devices and web browsers.
It very strongly depends on device screen. I have 4 devices, and colors are different on all of them
You have to setup your color profile in photoshop, by default photoshop gives you different colors when you save for web. Check out this tutorial step by step and let me know if this fixed your problem.
http://viget.com/inspire/the-mysterious-save-for-web-color-shift

Image processing, replace picture background or cut out picture background

In an Android app, I would like that the user choose or take a picture of him from / with his device and then replace the background by another one (for example an awesome beach).
I'm looking for a library that can cut out the original picture background (the original background can be a color or maybe a landscape). Or maybe a library that can give me some tools to draw the part of the picture to keep / remove.
If a such library does not exist, I think that the "pixel replacement" method is the best way if the original picture has a color background (for example, I look for all the black pixel and change them with a transparent pixel).
I have found this tutorial but as you can see the result is not perfect. Is there a way to do not check only one color but a range of colors ? Is there a way to define programmatically the range of colors to check ?
Thank you in advance for your tips and links !

Categories

Resources