Reading color pixels from a jpeg

Please help me
I would like to write a java program that imports a jpeg file and reads colors off the pixels from it (given the x, y)
i know java, however, i am still a novice. can you stir me unto a direction, wher i can do this? awt? swing? fileio?
if you have an idea of an algorithm ^_^ that would be even better!
thank you!

Image myJPG;
BufferedImage bi = new BufferedImage(myJPG.getWidth(null),myJPG.getHeight(null),BufferedImage.TYPE_INT_RGB);
Graphics g = bi.getGraphics();
g.drawImage(myJPG,0,0,null);
int rgb = bi.getRGB(pixelX,pixelY);
//if you want, now you can do
Color color = new Color(rgb);

Similar Messages

  • How to read XMP metadata from a Jpeg

    This seems like it should be a no-brainer, but I can't find any classes to do this ?? I can find classes to read song titles from MP3 files, I want to do similar with jpeg image files.
    In photoshop and lightroom you can set up titles and captions (and copyright info) in the metadata. When you save a jpeg this gets embedded in the file.
    How to read this info and parse it and use it once you have loaded it into a BitMapData???
    I am Flash/AS3.0 code only no IDE -  please no flex/AIR examples!
    Thanks!

    http://www.adobe.com/devnet/xmp/

  • Read color information from images.

    Can anyone explain getpixel() to me. I don't understand the manual with all it's Databuffer talk.
    Can I load an image and get straight access to it's pixels or is there something i have to do to the image before i can get access to it?
    Thank you.

    You can use the java.awt.image.PixelGrabber to get the pixels. And with the MemoryImageSource it is possible to work on the pixel array, and have the component you draw the image on updated.
    There is an example in the API for MemoryImageSource.

  • Read Pixels From Application

    Hi. I'm working on a project for fun in which I need the values associated with pixels at certain locations on a window of an application, which may or may not be changing.
    I've been looking around, but have only been able to find support for reading in pixels from a saved image. One bad way to do it would be to write a script that takes a screen shot and accesses the pixel from the saved image. However, I was hoping for a more direct way to do this because I will want to run this script many times and at a very rapid rate (the higher frequency, the better). The way I suggested would waste both processing time and memory. Is there a way to just have a script pull off the pixel value corresponding to an (x,y) coordinate relative to the entire screen?
    Any other suggestions?
    Thanks,
    Steve

    Hi Steve--
    This thread is a mess, because of all the formatting problems I was having -- not to mention that I somehow got the wrong idea of what you were after. Perhaps you could post your question again as a new thread, with whatever clarification you feel might help?
    In the meantime, I've been trying to figure out exactly what you're up to and my guess is that it might be (probably is?) dynamic image editing for various animation effects. I can see that the code I posted might be useful for size animation, so I tried this with an open Preview window
    (hope there are no formatting issues here):
    set TargetWinName to "MyPicture.jpg"
    -- you must enter the name of your window, or get script to enter it
    set Wins_ to windows of application "Preview" -- you must enter relevant application
    repeat with w_ from 1 to count items of Wins_
    set WinName to name of item w_ of Wins_
    if WinName contains " — " then set WinName to do shell script "echo " & quoted form of WinName & " | sed -e 's/(same note as before)*$//' -e 's/ — //'"
    if WinName is TargetWinName then
    repeat 100 times
    set WinBounds to bounds of item w_ of Wins_
    set bounds of item w_ of Wins_ to {item 1 of WinBounds, item 2 of WinBounds, (0.95 * (item 3 of WinBounds)), (0.95 * (item 4 of WinBounds))}
    end repeat
    exit repeat
    end if
    end repeat
    For me, this essentially makes the image vanish into its upper left corner, but there are all kinds of things you might do. I'm a bit surprised that it works as well as it does, as Preview has limited scriptability.
    I'm assuming (but may be wrong) that you want to do something like this with pixel color -- I don't know how to do that offhand, but I'm thinking about it. New post?
    Message was edited by: osimp

  • IMovie 10.0.5 crashes into millions of colored pixels when I add v/o narrative using Pages to read script from and using a USB mic attached to my iMac. I am running Mavericks OS X10.9.4

    Hi, I have been editing a project for a week and over the past 2 days iMovie 10.0.5 has crashed into millions of colored pixels about 6 times. I am working on a 27" iMac running OS X 10.9.4 with 6GB of Ram, plenty of space on start up disc (217 GB's)  The crash seems to coincide with any effort to use an external USB mic plugged in to record a narrative. I can record the voice over but a few minutes later I get some awful audio scrubbing sounds and then it pixelates. Why is this happening and how can I work around this to record a voiceover please? Any help would be greatly appreciated. I'm nervous to continue if my work is going to ultimately be lost. My project is currently about seventeen mins and includes, video clips from 2 different cameras (both Canon) a music track from iTunes and some still images (jpegs.)

    Thanks Erik,
    If nothing else, this huge list of updates and fixes, shows clearly that the Logic Dev team is working hard on fixing and improving LPX to a major degree.... and from the list of fixes done.. show they do read the bug reports submitted!
    As an aside....
    I recall how all the 'naysayers' prior to LPX (and in some cases, since...)  were proclaiming how Logic was dead, the team was being disbanded, we won't see any further development, the Dev team doesn't listen or care... and so on....... I wonder where those people are now?

  • HT1657 We just downloaded a movie from Itunes but the picture is completely scrambled. Audio is fine but all you can see are funny color pixels on the screen..how do we fix this?e

    We just downloaded a movie from Itunes but the picture is completely scrambled. Audio is fine but all you can see are funny color pixels on the screen..how do we fix this?

    The movie is from iTunes.   You would think that a download from iTunes to a MacBook could be watched on an HDTV using Apple TV without any headaches bit this does not appear to be the case. 

  • Can print color from Adobe Reader but not from Word

    I can print a color document from Adobe Reader. But if I print another color document from Word, it comes out in black&white. Both are on an HP Color LaserJet CP2025dn printer. The settings selected in the system Print dialog are the same. What's the trick?

    I hope you are doing well peggydii,
    Are recieving any errors like printer offline message?
    Can you see the printer in the computer as in the device and printers section?
    Run this tool HP print and scan doctor  Let me know if the tool finds any errors, I will do my best to help you.
    RobertoR

    You can say THANKS by clicking the KUDOS STAR. If my suggestion resolves your issue Mark as a "SOLUTION" this way others can benefit Thanks in Advance!

  • Read pixel from text file

    Hi, is it possible to retrieve an image just by reading some parameters or its pixel from a text file? If yes, could anyone give me some ideas on how to do that? How do you also retrieve a specific line or value from a text file?
    Thanks.

    Hi Fred,
    it seems you started a new thread for that very same topic - again...
    Why can't you keep things in one place? Why do we have to hop between several threads of yours to get all relevant information?
    "if I want to read line 13 of my text file"
    Same question as in the other thread: Where do you start to count? 0 or 1?
    Have you tried to wire a "13" to the ReadLine function?
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How can I read color from frond-end PC

    Hi Everybody,
    I have en HTML- control in my GUI and I would like to adjust back ground color of my HTML page to actual client color scheme. Does anyone known how can I read the color settings from client pc?
    Best regards
    Bogdan

    Hi,
    If you are using LOAD_HTML_DOCUMENT method to load the repository object, then pass a merge_table which contains an instruction to replace the background:
    TYPE-POOLS SWWW.
      DATA: l_merge_table TYPE swww_t_merge_table,
            l_merge_item  TYPE swww_t_merge_item,
            l_html_table  TYPE TABLE OF w3html,
            l_html_line   TYPE w3_html,
            l_url         LIKE me->url.
        CLEAR l_html_table.
        l_html_line = ' '.  " No background color, use default
        APPEND l_html_line TO l_html_table.
        l_merge_item-name = '<!BACKGROUND!>'.  " Tag to be replaced
        l_merge_item-html = l_html_table.
        l_merge_item-command = ' '.     " blank means replace tag line
        APPEND l_merge_item TO l_merge_table.
        CALL METHOD html_view->load_html_document
             EXPORTING
                  document_id  = 'DOCID'
             IMPORTING
                  assigned_url = l_url
             CHANGING
                  merge_table  = l_merge_table
             EXCEPTIONS
                  OTHERS       = 1.
    I have not tried this code but hope it helps,
    Rao A

  • How to write java code to read the pixel color in some place of screen?

    Hello all:
    How to write java code to read the pixel color in some place of screen?
    The java application iteself doesn't have any GUI.
    thank you
    -Danel

    See java.awt.Robot

  • I can't download my library books to my Color Nook from the digital reader. Any suggestions?

    I can't download my library books to my Color nook from the adobe digital reader. Any suggestions?

    You may want to ask at the Adobe Digital Editions (ADE) forum.
    http://forums.adobe.com/community/adobe_digital_editions
    Adobe Reader has not "done" DRM protected "books" for some time.
    Be well...

  • Reading grayscale values from saved image

    Hi,
    I've written several methods that crop, convert to grayscale, histogram equalise and then resize a colour jpeg image for preparing sets of images for a face detection neural network. The next thing I want to do is to write a method that allows me to read that saved grayscale images pixel values back as singular grayscale values from the RGB values that were used to save the jpeg. I used this code to create the 2D array of grayscale pixel values
          for (int i = 0; i < imageWidth; i++)
                for (int j=0; j <imageHeight; j++)
                    grayRGB[i][j] = (rgb[i][j] & 0xff000000) | (eqGray[i][j]<<16) | (eqGray[i][j]<<8) | (eqGray[i][j]);
                    img.setRGB(i, j, grayRGB[i][j]);
                }and then used this code to resize the image:
            BufferedImage resized = new BufferedImage(20,20,1);
            Graphics2D g = resized.createGraphics();
            g.drawImage(img, 0, 0, 20, 20, null);
            g.dispose();my class gets the RGB values on instantiation as follows:
            //get RGB pixel values for image loaded
            for (int i = 0; i < imageWidth; i++)
                for (int j=0; j <imageHeight; j++)
                    rgb[i][j]= inputImage.getRGB(i,j);
                    //perform bitwise shift rgb information values to obtain appropriate values for each colour pixel
                    r[i][j]=  (rgb[i][j] >> 16) &0xff;
                    g[i][j]=  (rgb[i][j] >> 8) &0xff;
                    b[i][j]=  (rgb[i][j]) &0xff;
                }Is there a way to get the grayscale values directly from an image that is already converted to grayscale without having to perform the grayscale conversion method again, perhaps using a similar bitwise shift?
    Thanks
    Nick

    answering this myself for those lost souls like i was a while ago:
    the answer is very simple when you get to know it :) : use a signed type for your image. this can be achieved by using the Format Operator (javax.media.jai.operator.FormatDescriptor). an example as follows :
            BufferedImage bufferedImage= someimage...
            ParameterBlock pb = new ParameterBlock();
            pb.addSource(bufferedImage);
            pb.add(DataBuffer.TYPE_SHORT);
            RenderedImage formattedImage =
                    JAI.create("format", pb, null);
    // you may use as well TYPE_DOUBLE or TYPE_FLOATimage could be of any type such as PlanarImage, BufferedImage, RenderedImage etc..
    then all you need to do is read your pixel values by using an iterator such as RectIter or RandomIter to access pixel values etc..
    San

  • How do i match a color exactly from an .eps file?

    How do I match a color in pages exactly from a jpg or eps file?

    The Color Selector has an eyedropper tool, the magnifying glass next to the color field at the top. Click on it and anywhere on screen to pick up a color.
    Why not just open the eps in Pages, which will convert it to a .pdf?
    .eps/ai/pdf files may have spot colors and they can't be matched exactly in Pages but will print through from the .pdf file as a separate plate.
    jpegs do not have an "exact color", they are made up of a cluster of different colored pixels.
    Also there will be differences depending on whether the color you are selecting is RGB or CMYK.
    Peter

  • Lightroom color cast question of JPEG image

    Lightroom color cast question of JPEG image
    Camera Canon MKII Color Matrix Adobe RGB
    Photoshop CS Color Setting Adobe RGB (1998)
    Lightroom 1.2 as new lightroom user I did not think that I needed to choose a color setting or color profile until I am ready to print my photos. I have not done any preset camera calibration.
    Link to my website with example photo http://www.basecampphotos.com/color.jpg
    My question is why is Lightroom displaying the images with a yellow color cast ? The image is a print screen from Lightroom on the left and Photoshop on the right The color cast problem can be seen in the white walls of the stairway. Also when viewing the image with Windows Picture and Fax viewer the walls are white as expected.
    Any ideas or suggestions as to why Lightroom is displaying the images with the yellow color cast or what I need to do to correct the issue ?
    Thanks
    Jim

    Almost definitely a corrupt monitor profile. Time and again this turns out to be the cause of such differences between PS and LR. You need to recalibrate the monitor or if you do not have a hardware calibrator, delete the profile from windows' monitor properties pane to test and then get a hardware calibrator.
    P.S since you are using adobeRGB jpegs, Windows picture and Fax viewers cannot give you the correct colors even on a calibrated monitor. Those are not color managed programs (I believe picture viewer finally is in Vista but definitely not in XP which you appear to be using). Also, PS has to be correctly set up to always preserve embedded profiles and to ask when you have profile mismatches, otherwise even PS will give incorrect color. Make sure to set this up in Edit>Color settings.
    P.S.2: Make sure you are not applying defaults in Lightroom to your images either on import or elsewhere. Sometimes people by accident define develop defaults that in this case might contain a white balance shift. Go to LR preferences and open the Presets tab. Here click on "Reset all default Develop settings" and make sure that only the auto grayscale checkbox is ticked. For images that it might have already happened to, make sure to hit the reset button.

  • Macbook pro screen turned black with different colored pixels after ios installation. Starting up dont seems to be a problem.

    I got hurry, my wife needs the macbook tomorrow for school. Can someonen tell me what to do? Reinstalling mountain lion  doesnt help. Reseting the PRAM and smd doesnt work either. The colored pixels are in a horizental lined pattern. When starting up the macbook everything seems to be okay untill the homescreen disappears.

    iOS is for mobile devices.
    Disconnect all peripherals from your computer.
    Boot from your install disc & run Repair Disk from the utility menu. To use the Install Mac OS X disc, insert the disc, and restart your computer while holding down the C key as it starts up.
    Select your language.
    Once on the desktop, select Utility in the menu bar.
    Select Disk Utility.
    Select the disk or volume in the list of disks and volumes, and then click First Aid.
    Click Repair Disk.
    Restart your computer when done.
    Repair permissions after you reach the desktop-http://support.apple.com/kb/HT2963 and restart your computer.
    Uninstall the iOS app & repair permissions again.

Maybe you are looking for

  • Web Gallery-Surprising Differences between Safari and Firefox

    I discovered some surprising differences using Web Gallery in Safari vs. Firefox: 1. When you first view an album the gallery, the thumbnail photos take quite a bit longer to be visible in Safari than in Firefox. 2. When rolling the mouse over the Su

  • BPC 7.5 NW SP 4 - ERRORVALIDATION SCRIPT LOGIC WITH PROGRAM CURR_CONVERSION

    Hi Gurus I´m copying script logic for currency conversion for consolidation application, but when I want to validate this code *RUN_PROGRAM CURR_CONVERSION *ENDRUN_PROGRAM the system generate this error "run program error, message number:"" is very s

  • White areas in safari when viewing iweb site I created

    Ok Here is my problem! I have created a website on iweb 08 which includes an autostart quicktime movie as an intro. When I view the site in Safari 3.2.1 strange white areas appear in the browser window. They disappear if 1 click outside of the browse

  • Problem between IPhone 3G et ios 4

    I have got a Iphone 3G. I installed ios 4. And since everything is slower. Did Apple make a mistake about the adaptivity og 3 and ios 4 ?

  • Wha?? Garageband '08 projects won't open in Logic Pro 7.2.3!!!

    I'm upset. I like starting recording projects using Garageband and then opening them up in Logic for more power after the rough arrangements are done. Just upgraded to iLife 08 and recorded a new tune using Garageband 08 and when I try to open the so