I wanna make the same(https://play.google.com/store/apps/details?id=appinventor.ai_yuanryan_chen.BT_LED) app. I want to get a color of some pixel like here(https://i.stack.imgur.com/ixz84.png). How can I get the color(rgb)?
You don't need to do it from scratch since there is a set of readily-made libraries for colour picking, for example, this library:
https://github.com/jbruchanov/AndroidColorPicker
for more libraries you can check this:
https://android-arsenal.com/tag/18?sort=created
Related
I have a colored textual Image to be in black and white.
Specifically the text to be in black and background to be in white for whatever colored it might be
I am using JAVA to perform this operation.
Can anybody help me out to with a code snippet or point me to a discussion which is useful.
if you want to develop your own converter RGB to Black/White, please check Java - get pixel array from image . Here you import a image, access the pixel and with a specific threshold of the color you can decide to convert to black or white.
Or you use http://www.imagemagick.org/ as commandline tool (with api http://www.imagemagick.org/script/api.php).
Regards
There are only a few standard colors available in the API - Java.Color. I want many more colors.
I want to create my custom colors using some GUI color maker, then get the code for that and save it as a custom color which can be used later.
How can I do this ?
Have a look at JColorChooser. It enable users to choose from a palette of colors. Read more at How to Use Color Choosers.
Check out this applet i use it when i want to find a particular colour code for a custom colour
http://www.javaview.de/vgp/tutor/color/PaColorDemo.html
just take note of the RGB values and build the custom colour using these
Go to http://www.colorspire.com/rgb-color-wheel/ and select your color and in code create the color object with r, g, b values.
Within the frame of a chess applet, I have a few sets of such greyscale/black & white (not sure) :
Is there any way to give a color tint to a PNG picture via Java Code ? Tried to google the matter and didn't find anything really matching what I'm looking for.
For the following piece for example, I'd like to give it white/yellow tint for the White player, and a flavour of black for the Black player. The idea of setting the color dynamically is to tweak themes at runtime.
It would be a lot simpler to give your program translucent images (PNG) which are plain coloured (plain or gradient) in the colours you want, and have a certain % of transparency (you can do that in photoshop/illustrator in 1min).
Then programmatically merge the tint image (preserving transparency) with the other image underneath.
Check this SO post for how to merge two images:
Merging two images
I found this on StackOverflow. It's pretty good explanation, so I won't bore you with any additional details :) Hope that helps: Applying a tint to an image in java
So I am doing a group project for my programming class, we are makeing a photo editing program and one of my parts of the program is taking the image and turning it into black and white using rgb. I was wondering what would be the best value or way in RGB to achieve black and white?
I would recommend letting the Java 2D library worry about the conversion:
create a greyscale BufferedImage (BufferedImage.TYPE_BYTE_GRAY);
get a graphics context by createGraphics()
ensure that colour rendering is accurate on that graphics context: call setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY)
draw the colour image you want to "convert" to the graphics context
If you do the conversion "manually" and you want to do it as accurately as possible, then you need to take into account that the eye is more sensitive to certain colour components than others. (If you want a "rough and ready" conversion, you can average the colour components, but this isn't strictly speaking the most accurate conversion.)
For each pixel, you can convert the RGB to HSB (using Color.RGBtoHSB), set the saturation to 0, and convert back to a Color instance using Color.getHSBColor.
Wikipedia actually has a good piece about how to perform the transformation once you have the RGB colors.
Hey , this page has many Java Image filters which are freely available for download.All filters are standard Java BufferedImageOps and can be plugged directly into existing programs.The GrayscaleFilter can convert the image to black and white
Using java.awt.image.ColorConvertOp with a gray destination ColorSpace is very efficient. There's an excellent example here.
I am trying to get the different amount of colors inside an image in java, but I don't know if there is a library for this propose of not. the project is about finding out the different colors from one image, and then print out the name of the colors. any idea??? please help me if you have any answer.
You can turn an image into a BufferedImage and call getRGB(int x, int y) to get the rgb for each pixel. Then you can use one of the many color websites such as this one or this one to map the rgb to a color name. Just find the named color which is the closest in distance to each rgb in the image.
Java has the Java Advanced Imaging (JAI) library which is built to allow stuff like this.