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

Similar Messages

  • 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, Bob

    Here 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.

  • 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 colour of a pixel in an Image?

    Can I get the colour of a pixel in J2ME, like BufferedImage.getRGB(int x, int y) in J2SE?
    Thanks.

    Did you manage to solve this one? I am trying to do something very similar, but can't find the J2ME equivalents either.
    Graham.

  • The color of a pixel in Graphics

    Hi... does anyone know how to get the Color of a specific pixel in a Graphics object??
    For example:
    public void paint(Graphics g) {
    // Something like this would be great! (but it doesn't exist)
      Color c = g.getColor(10,10);
      /* etc... */
    }Does anyone know something about it?

    http://www.rgagnon.com/javadetails/java-0257.html

  • Setting the color of individual pixels in a bufferedimage

    i am trying to set the color of each pixel in a loop as follows:-
    BufferedImage bi=new BufferedImage(w,h,BufferedImage.TYPE-INT_RGB);
    for(int j=0;j<h;j++){
    for(int i=0;i<w;i++){
    pixel=translate(i,j);
    clr=findcolor(pixel);
    if(clr==-1){
    bi.setRGB(i,j,0);
    else
    bi.setRGB(i,j,clr);
    findcolor() function just returns an int, so how do take this integer value and set the appropriate color?
    when i execute this code,in the PaintComponent method of a JPanel class, my entire panel becomes black, this is not because of my first "if" condition.i checked the return value of my findcolor function.
    However if i multiply the color value by a large number like 10000, then i get a few colors only(black,blue, green)
    So please let me know how i can get all colors, without having to multiply the value.

    What do the translate and findcolor methods do?

  • The app icons I have on the iPad have just come up blank with the app name under it. How do I get the colorful icons to appear? The apps do work though

    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.

  • I have an IPhone 4S. My color pictures and all icons have lost their color. How do I get the color back? Did I touch a wrong button?

    I have an IPhone 4S. All my color pictures and icons turned to looking like a negative.  No color! How do I get the color back on my phone?

    Hi ladwwd56,
    Welcome to the Support Communities!
    Is it possible that you may have an Accessibility feature called "White on Black" turned on?
    See page 244 of the iPhone User Guide PDF:
    http://manuals.info.apple.com/MANUALS/1000/MA1539/en_US/iPhone_iOS4_User_Guide.p df
    White on Black
    Use White on Black to invert the colors on the iPhone screen, which may make it easier to read the screen. When White on Black is turned on, the screen looks like a photographic negative.
    Invert the screen’s colors: In Settings, choose General > Accessibility and tap the “White on Black” switch.
    If that is not the case, try restarting / resetting the iPhone:
    iOS: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/HT1430
    If that does not resolve the issue, refer to page 146 in the iPhone User Guide to Reset All Settings:
    iPhone User Guide for iOS 7
    manuals.info.apple.com/MANUALS/1000/MA1565/en_US/iphone_user_guide.pdf
    Happy New Year!
    - Judy

  • Using a script to get the color of a colorized Black & White Bitmap image

    I've been running into this wall for quite some time and would greatly appreciate any help that can given for it.
    I have an Illustrator script that runs inside of a BridgeTalk session within an InDesign script.  Yeah, it's complicated.  The upshot is that the Illustrator part opens up an EPS file, looks through all objects on a certain layer in that file, and returns an array of the colors used in it.  So, it looks at fill colors, stroke colors, gradient stops, etc.  One of the biggest stumbling blocks (next to PlugIn Items, which I'll ask about in a separate post) is getting the color of raster images.
    Most raster images, I realize, are going to be CMYK or RGB images, but our company mostly deals with either Grayscale images or Black & White Bitmaps that are embedded in the EPS file.  Those two allow the ability to colorize them by simply selecting them and then choosing a color, such as a spot PANTONE color from one of their color books.
    Now, I need the script to read the color that the raster image has been colorized with.  This works okay for images that have a GrayScale color space, as the script just looks at Colorant[0] of that image.  However, I run into a problem with Black & White Bitmap images.  Here's a piece of code that I try to make work with an EPS file that has a raster image:
    var document = app.activeDocument;
    for (var i = 0; i < document.layers[0].pageItems.length; i++) {
              // Stepping through each item on the layer.
              var currentItem = document.layers[0].pageItems[i];
              $.writeln("Current item is " + currentItem.typename);
              $.writeln("Number of channels is " + currentItem.channels);
              $.writeln("Color Space is " + currentItem.imageColorSpace);
              $.writeln("Colorized Grayscale? " + currentItem.colorizedGrayscale);
              $.writeln("Number of Colorants: " + currentItem.colorants.length);
              for (var j = 0; j < currentItem.colorants.length; j++)
                        $.writeln("Colorant number " + j + " is " + currentItem.colorants[j]);
              $.writeln("Its parent is " + currentItem.parent);
              $.writeln("Parent's typename is " + currentItem.parent.typename);
    This code runs successfully on an Illustrator file that has a Black & White Bitmap image on the top layer, but if you try and run it, you'll see the problem:  Even if you've colorized your Bitmap image with a PANTONE spot color (and the script even returns "true" on the line "Colorized Grayscale?"), Colorant number 0 is "Gray".  It should be the spot color assigned, not "Gray".
    Can anyone please help me figure out how to get the script to recognize the actual colorant of a Black & White Bitmap image in Illustrator?

    If you're a professional photographer with 50,000 pictures stored now and more coming all the time, you need to forget about using iPhoto and get yourself some professional-quality digital asset management software. iPhoto is not meant for people like you, and instead of providing a simple, elegant one-stop answer to all your needs, iPhoto is actually complicating your life.
    You need an application that will:
    - catalog ALL your images and keep track of where they are, no matter how many DVDs, folders, partitions or hard drives they're spread over;
    - display thumbnails of ALL of them, even when the DVD that contains them is not present in any drive, so you can select all the ones you want for a project;
    - find and copy (or export) the originals of all the files you've selected in the browser window, even if it means prompting you to insert the necessary DVDs for all of them.
    I suggest Googling "digital asset management software Macintosh" and seeing what turns up. I used to use an old version of Extensis Portfolio, and even that would have been better for your purposes than iPhoto is.

  • Recently i have been getting the color wheel a lot and it is screwing with my happiness.  Any thoughts on how to clean the computer up so this stops?

    Recently i have been getting the color wheel a lot and it is screwing with my happiness.  Any thoughts on how to clean the computer up so this stops?

    Back up all data immediately as your boot drive may be failing.
    If you have more than one user account, these instructions must be carried out as an administrator.
    Triple-click anywhere in the line below on this page to select it:
    syslog -k Sender kernel -k Message CReq 'Channel t|GPU D|I/O|Previous Sh' | tail | open -ef
    Copy the selected text to the Clipboard (command-C).
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V).
    The command may take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear.
    A TextEdit window will open with the output of the command. If the command produced no output, the window will be empty. Post the contents of the TextEdit window (not the Terminal window), if any — the text, please, not a screenshot. The title of the window doesn't matter, and you don't need to post that.

  • I have been having a issue with getting the colors on my monitor to match the colors fro my print lab. I now have the monitor calibrated to match the prints but when I open elements it doesn't use the same colors. If i have it use the calibrated profile b

    I have been having a issue with getting the colors on my monitor to match the colors fro my print lab. I now have the monitor calibrated to match the prints but when I open elements it doesn't use the same colors. If i have it use the calibrated profile by changing the color management settings, the color picker no longer shows true white or black. How do I get elements 12 to honor the new calibrated settings?

    Ok so I've done what you said and this is what it's come back ....
    I don't know that these are the errors , but they're the things which don't look right ...
    Throughout the shut down there is a recurring line ;
    It says ;
    Com.apple.launchd 1 0x100600e70.anonymous.unmount 301 PID still valid
    Then there are 2 more which I think are related ;
    Com.apple.securityd 29 PID job has I overstayed its welcome , forcing removal.
    Then the same with fseventd 48 and diskarbitrationd 13
    Oh and on Launchd1 : System : stray anonymous job at shut down : PID 301 PPID13 PGID 13 unmount...
    Then the last process says "about to call: reboot (RB_AUTOBOOT).
    Continuing...
    And stops ...
    Hope this means something to you ... Thanks again for your help so far :-)

  • Possible to get the color space and resolution from the .eps file

    Hi all,
    We have using the InDesign CS3 5.0.4, windows, javascript.  We need to get the color space and resolution of the graphics (.eps) file using scripting.
    The properties of the image like (actualPpi and effectivePpi will return the value only for the .tiff. and .jpg etc) but it will not return the .eps file resolution values.
    Kindly give me the suggesting for the decrepancies.
    Regards,
    Nagaraj

    ... open them programmatically in PhotoShop, read out resolution and color space ...
    On opening them in Photoshop, it asks you "what resolution shall I use, and what color space shall I apply?"
    A single EPS may contain any number of embedded bitmaps, with any horizontal and vertical resolution, and in any color space. You can use only a few of these with Illustrator -- and even only one at a time with Photoshop --, but other programs allow just about every possible combination.
    Not to mention procedurally generated bitmaps, also possible with PostScript.

  • How do I get the color wheel to stop spinning?

    how do I get the color wheel to stop spinning?

    To invoke the Force Quit window, press Command-Option-Escape.
    If no joy, try holding down the Control key while you press the Eject key. This is supposed to bring up this dialog:
    If no joy there, you may have to resort to holding the Power-On key until the machine shuts off. This may leave un-repaired Directory damage, so it is a good idea to hold down the Shift key when you Restart. This invokes Safe Mode, which takes five minutes to run one pass of Disk Utility (Repair Disk), then starts with minimal extensions loaded. You will need your username and password to log in, even if you normally auto-login.
    Poke around a little, if all looks OK, you can restart in normal mode.

  • I have a color management problem.  I have OS X v 10.5, Adobe Photoshop Elements 6, and an Epson Stylus Photo R800.  I want to print images I have scanned on a Epson Perfection 1660 Photo and corrected in Photoshop and get the colors accurate.

    i have a color management problem.  I have OS X v 10.5, Adobe Photoshop Elements 6, and an Epson Stylus Photo R800.  I want to print images I have scanned on a Epson Perfection 1660 Photo and corrected in Photoshop and get the colors accurate.

    I used the ColorSync utility to verify, and it came back with this report:
    /Library/Printers/EPSON/InkjetPrinter/PrintingModule/SPR800_Core.plugin/Contents /Resources/ICCProfiles/SPR800 Standard.icc
       Tag 'dmnd': Tag size is not correct.
    /Library/Application Support/Adobe/Color/Profiles/Recommended/CoatedFOGRA27.icc
       Tag 'desc': Tag size is not correct.
    /Library/Printers/EPSON/InkjetPrinter/ICCProfiles/Standard.profiles/Contents/Res ources/Epson IJ Printer.icc
       Tag 'dmnd': Tag size is not correct.
    /Library/Printers/EPSON/InkjetPrinter/PrintingModule/SPR800_Core.plugin/Contents /Resources/
    I did not know what to do next.  At the bottom of the window it said to go to www.apple.com/colorsync to find a tutorial.  I got a message saying that link does not work.  Tried to find the tutorial by searching at apple.com, but could not seem to locate it.  Does anyone know what the report above means and what I should do about it?  
    Also, how to find that tutorial?
    Re Using RGB all the way through, When I print from Photoshop Elements, I select Adobe RGB, Photoshop Manages under "Color Handling", Relative Colometric  under "Intent" and "ColorSync" i the Epson printer box.  Do you mean to do something different in this sequence?

  • Getting the index of a pixel in an indexed image

    Hi,
    Is it possible to get the index of a pixel in an indexed image? I mean, indexed images (GIF, indexed PNG) are like:
    INDEX R G B
    0 234 22 143
    1 9 123 213
    2 56 43 10
    etc.
    I'm wondering if it exists a GET method to retrieve this INDEX, as getRGB() retrieves the sRGB value of a pixel.
    Thanks in advance.

    Raster.getSample:
    import java.awt.image.*;
    import java.io.*;
    import java.net.*;
    import javax.imageio.*;
    public class IndexColorModelTest {
        public static void main(String[] args) throws IOException {
            URL url = new URL("http://forum.java.sun.com/images/reply.gif");
            BufferedImage bi = ImageIO.read(url);
            ColorModel cm = bi.getColorModel();
            if (!(cm instanceof IndexColorModel))
                throw new IOException("ColorModel is " + cm.getClass());
            WritableRaster r = bi.getRaster();
            for(int y=0, uby=r.getHeight(); y<uby; ++y) {
                for(int x=0, ubx=r.getWidth(); x<ubx; ++x) {
                    int sample = r.getSample(x, y, 0); //<<--------<<
                    //if (sample < 100)
                    //    System.out.print(" ");
                    if (sample < 10)
                        System.out.print(" ");
                    System.out.print(sample);
                System.out.println();
    }

Maybe you are looking for

  • Adobe Pro 8.0 Mac to Windows Font Issue

    Here is my dilemma: We have a fillable form created in Acrobat Pro 8.0 on a Mac. It is sent to a Windows Vista (Acrobat Reader) user who then fills it, saves it and sends it to a Windows XP user (again using reader). When the XP user opens it, the ch

  • Cant update E330 Bios on Windows 8.1

    Hello, I im running Windows 8.1 on a lenovo Thinkpad E330. I have downloaded the utility but it doesnt work (has stopped working) I removed the password on the BIOS and enabled UEFI Bios update. What can i do? I had the same on Windows 7. Thank you

  • Can the Organizer in version 9 handle RAW files?

    Before I teach the Organizer to new people, I am wondering what frustrations people will encounter if they have high megapixel cameras and are using RAW? Thanks for your help. Mary Lou

  • Getting "random" NoClassDefFoundError in applet

    I'm developing a JDK 1.3.1 applet (JApplet), and I test it by loading it in Netscape Navigator (6.1). However, I frequently get the message "Applet <applet> notinited" in the browser, and when I look at the Java Console I see the message "java.lang.N

  • Add 2 numbers!!

    Hi All, I wanna add these 2 nos from the Query select 11,199 + 12,119 from dual But don't want 2 remove comma caz comma is comming from default in request. Urgent Help