Get pixel color in J2ME
hello,
if u know how to retrieve the pixel color of any specified coordinate pixel
,say (x,y) of a canvas please let me know ,i ll be thankfull to u.
you can try to create a new image and paint on that image.
Image img = new Image( yourcanvaswidth, yourcanvasheight );
yourcanvas.paint( img.getGraphics() );
int [] rgbs = new int[ yourcanvaswidth, * yourcanvasheight ];
img.getRGB( rgbs, 0, yourcanvaswidth, 0, 0, yourcanvaswidth, yourcanvasheight );
the rgbs holds RGB values of you canvas.
hope this will help
Similar Messages
-
What function do I use to get pixel color of screen
ChangChiTheGraphics
chang ChiHello C.H.Chi
This code might solve your problem.
public partial class Form1 : Form
public Form1()
InitializeComponent();
Bitmap myBitmap;
private void Form1_MouseMove(object sender, MouseEventArgs e)
Color pixelColor = myBitmap.GetPixel(e.X, e.Y);
this.Text = pixelColor.ToString();
private void Form1_Load(object sender, EventArgs e)
myBitmap = new Bitmap(Properties.Resources.Tulips);
place a image in your resource file and access from their.
Kindly mark as answer if found useful. -
[iPhone SDK] Get pixel color
In OS X you can use NScolor Getcolor X Y to get the color of a specific pixel in a given image but this does not seem to be in the framework for the iPhone. Does anyone know how to do this?
thanks in advance
DaveHello C.H.Chi
This code might solve your problem.
public partial class Form1 : Form
public Form1()
InitializeComponent();
Bitmap myBitmap;
private void Form1_MouseMove(object sender, MouseEventArgs e)
Color pixelColor = myBitmap.GetPixel(e.X, e.Y);
this.Text = pixelColor.ToString();
private void Form1_Load(object sender, EventArgs e)
myBitmap = new Bitmap(Properties.Resources.Tulips);
place a image in your resource file and access from their.
Kindly mark as answer if found useful. -
I know nothing about java, but I 'll learn if I need. But first, I need to know if a java web applet can do the goal I need:
A java web applet that can pass a specific pixel color on the browser windows to javascript. The coordinates of that pixel will stay outside the own applet borders.
I don't know if this is the right forum, so can you please help me in any way?
Thanks a lot.
Julio Morales.juliochile wrote:
I know nothing about java, but I 'll learn if I need.
But first, I need to know if a java web applet can do the goal I need:Fair enough
A java web applet that can pass a specific pixel color on the browser windows to javascript. Yes this can be done, but as I recall it was somewhat of a pain. It will also be browser-specific. If you ask me the requirement is probably flawed.
The coordinates of that pixel will stay outside the own applet borders.Huh? So you need to sample a pixel? This post makes little sense. Post the exact use case. Way too vague. -
hello,
if u know how to retrieve the pixel color of any specified coordinate pixel
,say (x,y) please let me know ,i ll be thankfull to u.hello,
if u know how to retrieve the pixel color of any specified coordinate pixel
,say (x,y) please let me know ,i ll be thankfull to u. -
Please Help Get a Color from Pixel !!!!
Is anybody know how to get a Color from pixel.
My program is not Full Screen .
So i think Robot.getPixelColor() don't suitable.
Please Help me!Robot.getPixelColor() will work fine, but the problem you will have is getting the mouse set to the correct location and getting your application to know where it is: you can do it with win32 calls and JNI. Here are a few that I have found helpful--they are in a VB format:
Public Const CLR_INVALID = &HFFFF 'not a valid pixel
Public Const MOUSE_MOVED = &H1
Public Const MOUSEEVENTF_ABSOLUTE = &H8000 ' absolute move
Public Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Public Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Public Const MOUSEEVENTF_RIGHTDOWN = &H8 ' right button down
Public Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up
Public Const REQUEST_LEFT_CLICK = &H2D 'request left click "-"
Public Const REQUEST_RIGHT_CLICK = &H2B 'request right click "+"
Type POINTAPI
x As Long
y As Long
End Type
Type POINTSTRUCT
hwnd As Long
hdc As Long
ptAbsolute As POINTAPI
ptOrigin As POINTAPI
ptLocal As POINTAPI
ptColor As Long
sType As String
retMessage As Boolean
End Type
Declare Function GetCursorPos _
Lib "user32" (ByRef lpPoint As POINTAPI) _
As Long
Declare Function SetCursorPos _
Lib "user32" (ByVal x As Long, ByVal y As Long) _
As Long
Declare Sub mouse_event _
Lib "user32" (ByVal dwFlags As Long, _
ByVal dx As Long, _
ByVal dy As Long, _
ByVal cButtons As Long, _
ByVal dwExtraInfo As Long)
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Declare Function GetMessageExtraInfo Lib "user32" () As Long
Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, _
ByVal x As Long, _
ByVal y As Long) As Long
Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, _
ByVal yPoint As Long) As Long
Declare Function GetWindowDC Lib "user32" (ByVal hwnd As Long) As Long
Declare Function GetWindowOrgEx Lib "gdi32" (ByVal hdc As Long, _
ByRef lpPoint As POINTAPI) As Long -
Get the color of a pixel in an image
how can i do to get the color of a pixel in an image ???
Can anyone help me ?Hi,
first of all you need to get the library to transfer your image to java.awt.image.BufferedImage object.
I know many such libraries. Its depends of what kind of image you have: jpeg, gif, png or other.
And when you get the BufferedImage of you picture using library, then you can get the color of any pixel in image using int BufferedImage.getRGB(int x, int y) as integer value.
Victor Letunovsky -
Get the color of a pixel on the Stage
Is there a way to retrieve the color of a generic pixel on the screen using the mouse pointer inside the Stage of Flash Player? With the getPixel method of the BitmapData class you can get the color of a pixel only if the mouse is over a bitmap image, but what if I need the color a generic pixel on the screen?
this takes a snapshot of the pixel below the mouse:
function eventHandler(event:MouseEvent):void
var bmd:BitmapData = new BitmapData(1, 1, false, 0x000000);
var matrix:Matrix = new Matrix();
matrix.translate(event.stageX, event.stageY);
//can never remember which way translate works so it could be:
//matrix.translate(-event.stageX, -event.stageY);
bmd.draw(stage, matrix);
var pixelColour:uint = bmd.getPixel(0, 0);
my blog has more info: http://blog.leeburrows.com/2010/09/bitmapdata-basics-1/ -
Getting the Color of a Pixel in a Image
Hi. I need to get the Color of the point in an Image (or ImageIcon). I've seen examples but they use BufferedImages.
Thanks, BobHere is a simple conversion for you:
BufferedImage bi = new BufferedImage(myImage, myImage.getWidth(null), myImage.getHeight(null), BufferedImage.TYPE_INT_RGB);
Graphics g = bi.getGraphics():
g.drawImage(myImage, 0, 0, null);If you are using ImageObserver objects, then replace null with the corresponding ImageObserver object in the BufferedImage and drawImage. -
How to get pixel colour?
Is there any way to get pixel colour from specified point? Example: colour = image.getPixel(x, y);
J2ME/MIDP 1.0
Thanks!{color:#800000}*I am happy to compare the two pixels of same image using this code in Java:*
{color}
Image ori, nw;
public void init()
{ ori = getImage(getDocumentBase(),"flower.jpg");
int pxl[]= new int [65536];
PixelGrabber pg = new PixelGrabber(ori,0,0,256,256,pxl,0,256);
// Image is stored into Array
try{ pg.grabPixels(); }
catch(InterruptedException e) {}
for(int i=0;i<65536;i++)
{ int p = pxl[i];
int ri = (0xff & (p>>16));
int gi = (0xff & (p>>8));
int bi = (0xff & p); // Take the RGB value of each pixel
for(int j=0;j<255;j++) // Chk. other similar pixel in color range of 0 to 255
int q = pxl[j];
int rj = (0xff & (q>>16));
int gj = (0xff & (q>>8));
int bj = (0xff & q);
if ( (ri==rj)&&(gi==gj)&&(bi==bj)&&(!(i==j)))
{ ri+=70;//if (ri<0) ri = 0;
gi+=70;//if (gi<0) gi = 0;
bi+=70;//if (bi<0) bi = 0;
pxl[i] = ( 0xff000000|ri<<16|gi<<8|bi); // Change value
else
pxl[i] = ( 0xff000000|ri<<16|gi<<8|bi);// Keep as it is
Email : [email protected], Profile: www.aribas.edu.in/Mr.Brijesh_Jajal.htm -
I have a video in excellent quality (1280x720 23,976 fps) I burn the dvd in encore cs6 with hd menu and I get pixelated. I've done transcoding but It downgrade to 480 I need urgent help.
Hi,
first, sorry if my english sucks jajaa i speach spanish, havent practice my english for a while.
first i edited my video in premier cc
sequence 1280X720, 59,94 fps
48000hz - stereo
the i linked it with dynamik link to after, make some color correction, etc etc etc
i renderd in quicktime animation
my video looks fine in my computer, but when i send my .mov video to encore (cs6) in a HD MENU and standard menú, the image sucks.
i have done the transcoding in encore, but i doesnt work either. i dont know what else to do. -
I have an object of "Canvas" and I want to get the Color of the point where the user has clicked. How?
Fast and dirty: If you are not talking about an applet, you could use java.awt.Robot.
Better solution:
In Canvas the entire Canvas gets painted in the paint(Graphics) method. If you paint to an Image, not directly to the canvas, and paint that image to the Canvas to make it look the same, then you can find the color of any pixel by inspecting the Image. See the java.awt.PixelGrabber class on how to get the pixels of an image. -
Can i get a pixel color value without converting the picture data to an array?
Seems an unneccesary step in my opinion because internally the array data is available
anyway.
Neither the standard palette nor the vi.lib picture vis seems to contain procedures to read pixel values.If you are using MS Windows, and the image is displaying on a front panel, there is a Windows API: GetPixel (https://msdn.microsoft.com/en-us/library/dd144909(v=vs.85).aspx) for that.
George Zou
http://webspace.webring.com/people/og/gtoolbox -
How to get background color in MVC programming
Hi Experts,
I am new to BSP.
I am working in CRM 7.0 version and designing a view using MVC method in BSP.
I have two doubts::
1. How can i get background color in a view ?
2. How can i attach a picture, that is in paint-brush, in background ?
Thanks in Advance.
Nitin Karamchandani.
Edited by: Nitin Karamchandani on Jun 3, 2009 8:10 AMHi,
several html tags have the attribute bgcolor, like
<body bgcolor="red"> or <body bgcolor="RRGGBB"> where RR, GG, BB is an hexadecimal value according to RGB color palette.
you can also work with CSS and in this case you affect the attribute style, which is also available in several tags:
document.body.style.backgroundColor="#EEEEEE" -
The Ipad icons are all just a grey box. How do I get the colorful icons?
First thing to try is a reboot of your iPad. Press and hold the Home and Sleep buttons simultaneously ignoring the red slider until the Apple logo appears. Let go of the buttons and let the iPad restart. See if that fixes your problem.
Maybe you are looking for
-
Grouping channels in Audition?
Hi, Ok, I seem to be looking for an answer to this question by asking the wrong questions. I am moving to a new setup and my studio and using Audition CC to record but I seem to be lacking the proper Audition terminology..... What I want to do is tak
-
I rented a movie from Itunes but its has stopped playing at 22.33mins
its just a black screen, movie stops playing
-
9.2.0.6 Intersection Error
Weve recently upgraded to 9.2.0.6 as part of a major release and were seeing the following spatial error intermittently in our Production system which is causing us major problems. When we get this problem the whole GIS application grinds to a halt
-
Positioning Objects on the Page.
Hi, Expert: How can I position two objects on the page relatively? Say, I have two data tables, or one data table and after the table, some other object (button?, etc). B/c I don't know how many rows will return from the database, if I placed two tab
-
Hello, I am using latest version of JDev11g. Inside my model project I have some java classes along with app module and view objects. I am trying to set the where clause and order by clause programatically viewObject.setOrderByClause() and viewObject