Get binary from image

I'm trying to get the binary pattern from an image and store it byte by byte, so i can manipulate it.
Any help on how i would go about doing this would be greatfully recieved.
Perhaps a url to some relevant material would be nice. Thought I'd come to the guys who know about this sort of thing.
Thanks
Fraser

try {
            int[] pixels = new int[width * height];
            PixelGrabber pg = new PixelGrabber(img, 0, 0, width, height, pixels, 0, width);
            pg.grabPixels();
            return pixels;
        } catch (InterruptedException ie) { return null; }This code is an example using a pixel grabber to retrieve an array of int values, each representing pixel data.
int values are 32 bit, but the pixel data should only encompass the first 8 bits of each int.
You can't cast the int to a byte because it will chop off the bits from the other end leaving you with a byte full of 0's and a black image.
To convert these ints to bytes you can use bitwise operators to chop off the leading 0 bits and then build a byte array with your image data.

Similar Messages

  • Get color from image

    Hey people, I'm new to Illustrator and have a question. I want to use a color from an image that I put into Illustrator.
    The exact things I did with the image are the following: copied it from Windows Photo Viewer into Illustrator, then put the 'cut out' effect on it, then copied it into a new Illustrator document that has a businesscard template and resized it fit the template's margins. Now I want to kind of 'enlengthen' the image by putting a square next to it. To make it look smooth, it has to have the same color as that side of the image of course. But that's my problem, I'm not able to select the color from the image and make a new color group with that specific color. The 'get color from selected artwork' button doensn't help much since I can't click it, for some reason the mouse turns into this 'can't click here' icon every time I move it on this button.
    Any help would be greatly appreciated!
    PS apologies for any unavoidable noobness

    To sample a color from a raster image, ShiftClick with the Eyedropper tool. (CS3)
    Always state what software version you are using.
    JET

  • Get bytes from image

    Hi,
    Can someone please tell me how to get the bytes from an Image object in an applet. I need to send the data to php or asp script to save to image file on server. Preferably in jpeg format if thats possible. Thanks.

    what i need is to save an Image object to the server. I have written all the applet functionality in editing the image in various ways i just need to know how to get all the data and transform to jpeg data that can be sent from applet to a php script that simply writes the data it recieves to the disk. so far all ive been able to do is get short things like [B@4e2f0a to be written to the file on server. can someone please direct me as to waht i need to do and show me working code example or something. thanks alot.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Get colors from image

    Is there any way to get the colors from an image in photoshop? Ideally, I would like a simple process to get a swatch collection from an existing image.
    Thanks,
    CFH

    I don't know if this is the easiest way, but, change Mode to Indexed. Go to Mode>Color Table and Save the table with a new name. Then you should be able to load it in the Swatches palette from the flyout. Choose .act in the dropdown.

  • Problem displaying binary tif image from rfc

    Hello All,
    I am trying to display an image that is returned from RFC as binary image
    <b><u>Context description:</u></b>
    Context Node From RFC -  Out_Et_Image node type tbl1024
    Node element Line
    As I understand the node is representing a byte array and each Line element i a part of the array .
    <b><u><i>i did</i></u></b>
    <b>1. merge it into one byte array :</b>
    int ArrayTot = 0 ;
    for ( i =0;i<wdContext.nodeOut_Et_Image().size();i++){
         ArrayTot = ArrayTot+wdContext.nodeOut_Et_Image().getOut_Et_ImageElementAt(i).getLine().length     ;
         final byte[] pictureContentTemp1 = new byte[ArrayTot];
         for ( i =0;i<wdContext.nodeOut_Et_Image().size();i++){
              if(i>0){
                   j=j+wdContext.nodeOut_Et_Image().getOut_Et_ImageElementAt(i-1).getLine().length;
                   System.arraycopy(wdContext.nodeOut_Et_Image().getOut_Et_ImageElementAt(i).getLine(),0,
                        pictureContentTemp1,0,wdContext.nodeOut_Et_Image().getOut_Et_ImageElementAt(i).getLine().length     );
              }else{
                   j=wdContext.nodeOut_Et_Image().getOut_Et_ImageElementAt(i).getLine().length;
                   System.arraycopy(wdContext.nodeOut_Et_Image().getOut_Et_ImageElementAt(i).getLine(),0,
                                       pictureContentTemp1,j,wdContext.nodeOut_Et_Image().getOut_Et_ImageElementAt(i).getLine().length     );
    <u><b>2. using the IWDCachedWebResource to generate and display it</b></u>
    IWDCachedWebResource resource = WDWebResource.getWebResource
    (pictureContentTemp1,
    WDWebResourceType.GIF_IMAGE);
    resource.setResourceName("pic");
    try{
    IWDWindow window = wdComponentAPI.getWindowManager().
    createExternalWindow(resource.getURL(), "gggg", true);
    // Eliminate some features of the window
    window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
    window.removeWindowFeature(WDWindowFeature.MENU_BAR);
    window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
    window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
    window.setWindowSize(780,430);
    window.setWindowPosition(20,140);
    window.open();
    }catch (Exception e){
         wdComponentAPI.getMessageManager().reportException(e.getLocalizedMessage(),false);
    The problem is that I get a corrupted file and i cant see or open it .
    Some more details:
    The original image size is 42,234 bytes
    i get from the RFC after merging the array 43,008 bytes i think that the extra bytes that a get are the problem , but i don't have any idea how to get rid of them or solve the problem .
    My WAS version is nw04 sp19
    Does any one encounter this problem? Or can guide me what to do?
    Thanks
    Ronen

    Try this VI (It's from "Image Acquisition and Processing with LabVIEW" - see for more details...
    cheers,
    Christopher
    Christopher G. Relf
    Certified LabVIEW Developer
    [email protected]
    International Voicemail & Fax: +61 2 8080 8132
    Australian Voicemail & Fax: (02) 8080 8132
    EULA
    1) This is a private email, and although the views expressed within it may not be purely my own, unless specifically referenced I do not suggest they are necessarily associated with anyone else including, but not limited to, my employer(s).
    2) This email has NOT been scanned for virii - attached file(s), if any, are provided as is. By copying, detaching and/or opening attached file
    s, you agree to indemnify the sender of such responsibility.
    3) Because e-mail can be altered electronically, the integrity of this communication cannot be guaranteed.
    >
    Copyright © 2004-2015 Christopher G. Relf. Some Rights Reserved. This posting is licensed under a Creative Commons Attribution 2.5 License.
    Attachments:
    Image_Browser-Selector_Example.llb ‏107 KB

  • How do i get a scanned image from my canon printer to my macbook

    how do i get a scanned image from my canon printer to my macbook

    The Canon printer can be found in the System Preferences > Print and Fax.Click to reveal the list of printers in the left hand side bar. If your model has scan capabilities then you can click the Open Scanner submenu:

  • How do I get a raw image from "My Pictures" into Photoshop?

    How do I get a RAW image from "My Pictures" into Photoshop? When I send it to Photoshop , it shows up as a grey checkerboard. The title is on the top. Whe I try to send a picture from Camera Raw, it does the same thing.

    Has it ever worked or is this just something that started happening recently?
    Have you tried resetting the photoshop preferences file?
    http://forums.adobe.com/thread/375776?tstart=0
    Have you installed the latest updates for photoshop cs5?
    In photoshop cs5 go to Help>Updates
    To post the system info here on the forum it might depend on your browser, but using firefox as an example, you would open the system info in photoshop, press Copy then OK.
    Here on the forum you would press the ctrl key and paste.

  • Profile Imanges are not getting deleted from Profile Image library

    Hi,
    If I go mysite and edit my profile and set a profile images and save the changes. Image is uploaded to profile Image library in the root of the mysite.
    I Edit my profile again and this time I remove the profile image and save the changes. Image is not getting deleted from the profile Image library.
    as per my understanding it should get deleted. My site clean job is running. user profile is active in AD.
    Thanks
    Omkar

    My first question would be is it a big deal if the picture doesnt get deleted from the libarary?  My understanding is that the profile picture field is a URL link, the first time you add a picture it will provision 3 copies of differing sizes to the
    library.  When you "remove" the picture, it just empties out the picture URL field.  Which is a nice hidden recovery if someone accidently deletes a profile photo they really wanted (Or if your company really locks down picutures so you only get
    a choice of a couple avatars instead of a personal photo).
    Similar issue:
    http://social.technet.microsoft.com/Forums/sharepoint/en-US/17bc8538-568f-4fff-8933-458fdba4b701/delete-user-profile-picture-in-sharepoint-2010-when-account-is-deactivated-or-deleted-from-ad?forum=sharepointadminprevious
    and response:
    Since the user photo library follows certain standards OOB:
    http://iedaddy.com/2010/12/sharepoint-2010photo-management-for-social-mysites/
    I would say just create a small script that will periodically read the UPS and make sure there are no photos sitting in the library not associated to an account... here's an example of accessing the User Profiles w/ Powershell:http://iedaddy.com/2010/06/sharepoint-2010-updating-user-profile-properties-with-powershell/
    You would just modify it to delete image files whose name is not associated to an existing NTName in the UPS.
    ieDaddy
    Blog: http://iedaddy.com
    Twit: @iedaddy

  • Read Binary(raw Image) data from a file

    Hi
    PLEASE HELP, I want to Read Binary(Raw Image)data (16 bit integer) from a file and display on the JPanel or JFrame.

    Hi, you'll need to use MemoryImageSource.
    You read each RGB triple and add it to a pixel[].
    Heres the roughg idea.
    Hope that helps.
    Harley.
    int width,height;
    int[] pixels = new int[width*height];
    while(!fileDone)
    for(int i=0; i<(width*height) i++){
    int rgb = inputStream.readInt();
    pixels[i] = rgb;
    DirectColorModel colorModel = new DirectColorModel(16,0xff00,0x00ff,0x00ff);
    MemoryImageSource memImage = new MemoryImageSource(width,height,pixels,0,width));

  • Importing from Sony DV into iMovie & getting Darker video image

    Importing from Sony DV (Video quality looks great on video LCD screen) into iMovie & getting Darker video image. After I import into iMovie the video image is darker, making in harder to edit. I appreciate any help with understanding how I can improve the video quality when importing.
    Thank you

    Welcome to discussions!
    You may just need to adjust your monitor.
    http://www.danslagle.com/mac/iMovie/tips_tricks/6008.shtml
    Plus, it will look better on a TV than your monitor.
    Sue

  • How to get max 5 color from image??

    I try to get max 5 color from image (ex. jpeg,gif) ,I use PixelGrabber
    it too slowly when i use large image,Please help me, to run more fast
    (other way PixelGrabber)
    best regard
    [email protected],[email protected]
    source below:
    public String generateColor(InputStream source,String filePath){
    BufferedImage image = null;
    String RGB = "";
    System.out.println("==generateColor==");
    try {
    image = ImageIO.read(source);
    catch (IOException ex1) {
    ex1.printStackTrace();
    //image.getGraphics().getColor().get
    // BufferedImage image2 = ImageIO.read(source);
    // image.getColorModel().getNumColorComponents()
    if(image.getColorModel() instanceof IndexColorModel) {
    IndexColorModel icm = (IndexColorModel)image.getColorModel();
    byte[][] data = new byte[3][icm.getMapSize()];
    int[] rgbB = new int[icm.getMapSize()];
    icm.getRGBs(rgbB);
    String dataHtm = "<HTML><table width=\"100\" border=\"0\"><tr>";
    for(int i = 0 ;i< rgbB.length;i++){
    int r = (rgbB[i] >> 16) & 0xff;
    int g = (rgbB[i] >> 8) & 0xff;
    int k = (rgbB) & 0xff;
    System.out.println("red:" + Integer.toHexString(r));
    System.out.println("green:" + Integer.toHexString(g));
    System.out.println("blue:" + Integer.toHexString(k));
    dataHtm = dataHtm + "<td width=\"10\" bgcolor=\"#" + Integer.toHexString(r)+Integer.toHexString(g)+Integer.toHexString(k);
    dataHtm = dataHtm + "\"> </td>";
    dataHtm = dataHtm + "</tr></table></HTML>";
    try {
    BufferedWriter out = new BufferedWriter(new FileWriter("c:\\23289207.html"));
    out.write(dataHtm);
    out.close();
    catch (IOException e) {
    e.printStackTrace();
    int w = image.getWidth();
    int h = image.getHeight();
    int[] pixels = new int[w*h];
    int[] pixs = new int[w*h];
    System.out.println("image width:"+w+"image hight:"+h+"image w*h:"+(w*h));
    Image img = Toolkit.getDefaultToolkit().getImage(filePath);
    PixelGrabber pg = new PixelGrabber(img, 0,0, w, h, pixels, 0, w);
    try {
    pg.grabPixels();
    catch (Exception x) {
    x.printStackTrace();
    String picColor = "";
    Stack stackColor = new Stack();
    Hashtable hashColor = new Hashtable();
    for (int i = 0; i < w * h; i++) {
    int rgb = pixels[i];
    int a = (rgb >> 24) & 0xff;
    int r = (rgb >> 16) & 0xff;
    int g = (rgb >> 8) & 0xff;
    int k = (rgb) & 0xff;
    i = i+1000;
    //System.out.println("i:" + i);
    picColor = convertToSring(r)+convertToSring(g)+convertToSring(k);
    stackColor.add(picColor);
    //System.out.println("picColor:"+picColor);
    // System.out.println("\n\n a:" + a);
    // System.out.println("red:" + r);
    // System.out.println("green:" + g);
    // System.out.println("blue:" + k);
    }//end for
    getMaxColor(stackColor);
    System.out.println("==generateColor==end\n\n");
    return null;

    import java.awt.Color;
    import java.awt.image.BufferedImage;
    import java.io.IOException;
    import java.net.URL;
    import javax.imageio.ImageIO;
    public class HighFive
        private void examineColors(BufferedImage image)
            long start = System.currentTimeMillis();
            int w = image.getWidth(), h = image.getHeight();
            int[] rgbs = image.getRGB(0,0,w,h,null,0,w);
            findHighFive(rgbs);
            long end = System.currentTimeMillis();
            System.out.println("total time = " + (end - start)/1000.0 + " seconds");
        private void findHighFive(int[] colors)
            int[] uniqueColors = getUniqueColors(colors);
            int[] colorCounts  = getColorCounts(uniqueColors, colors);
            int[] highFive     = getHighFive(colorCounts);
            // for each value of highFive find index in colorCounts
            // and use this index to find color code in uniqueColors
            for(int j = 0; j < highFive.length; j++)
                int index = findIndexInArray(colorCounts, highFive[j]);
                Color color = new Color(uniqueColors[index]);
                String s = color.toString();
                s = s.substring(s.indexOf("["));
                System.out.println("color " + s + "  occurs " +
                                    highFive[j] + " times");
        private int[] getUniqueColors(int[] colors)
            // collect unique colors
            int[] uniqueColors = new int[colors.length];
            int count = 0;
            for(int j = 0; j < colors.length; j++)
                if(isUnique(uniqueColors, colors[j]))
                    uniqueColors[count++] = colors[j];
            // trim uniqueColors
            int[] temp = new int[count];
            System.arraycopy(uniqueColors, 0, temp, 0, count);
            uniqueColors = temp;
            return uniqueColors;
        private int[] getColorCounts(int[] uniqueColors, int[] colors)
            // count the occurance of each unique color in colors
            int[] colorCounts = new int[uniqueColors.length];
            for(int j = 0; j < colors.length; j++)
                int index = findIndexInArray(uniqueColors, colors[j]);
                colorCounts[index]++;
            return colorCounts;
        private int[] getHighFive(int[] colorCounts)
            // find five highest values in colorCounts
            int[] highFive = new int[5];
            int count = 0;
            for(int j = 0; j < highFive.length; j++)
                int max = Integer.MIN_VALUE;
                for(int k = 0; k < colorCounts.length; k++)
                    if(colorCounts[k] > max)
                        if(isUnique(highFive, colorCounts[k]))
                            max = colorCounts[k];
                            highFive[count] = colorCounts[k];
                count++;
            return highFive;
        private boolean isUnique(int[] n, int target)
            for(int j = 0; j < n.length; j++)
                if(n[j] == target)
                    return false;
            return true;
        private int findIndexInArray(int[] n, int target)
            for(int j = 0; j < n.length; j++)
                if(n[j] == target)
                    return j;
            return -1;
        public static void main(String[] args) throws IOException
            String path = "images/cougar.jpg";
            Object o = HighFive.class.getResource(path);
            BufferedImage image = ImageIO.read(((URL)o).openStream());
            new HighFive().examineColors(image);
    }

  • I have been streaming videos and music from my phone and iPad. I just got a new MacBookPro and when I try to stream from it, I get the mirror image, but no sound. ????

    I have been streaming videos and music from my phone and iPad. I just got a new MacBookPro and when I try to stream from it, I get the mirror image, but no sound. ????

    Hi Avonbikerider,
    If you are only having the audio issue when Airplay Mirroring from your MacBook Pro, you may find this forum discussion helpful:
    Apple Support Communities: No Audio when Airplay Mirroring from Mac to Apple TV
    https://discussions.apple.com/thread/4167956
    Regards,
    - Brenden

  • How do you remove face tagging icon from images.  I cannot get them off some images.

    How do you remove face tagging icon from images.  I cannot get them off!  This is for adobe photoshop elements 6.   Thanks

    The links below have instructions for deleting photos.
    iOS and iPod: Syncing photos using iTunes
    http://support.apple.com/kb/HT4236
    iPad Tip: How to Delete Photos from Your iPad in the Photos App
    http://ipadacademy.com/2011/08/ipad-tip-how-to-delete-photos-from-your-ipad-in-t he-photos-app
    Another Way to Quickly Delete Photos from Your iPad (Mac Only)
    http://ipadacademy.com/2011/09/another-way-to-quickly-delete-photos-from-your-ip ad-mac-only
    How to Delete Photos from iPad
    http://www.wondershare.com/apple-idevice/how-to-delete-photos-from-ipad.html
    How to: Batch Delete Photos on the iPad
    http://www.lifeisaprayer.com/blog/2010/how-batch-delete-photos-ipad
    (With iOS 5.1, use 2 fingers)
    How to Delete Photos from iCloud’s Photo Stream
    http://www.cultofmac.com/124235/how-to-delete-photos-from-iclouds-photo-stream/
     Cheers, Tom

  • Can i get information from an image file??

    sorry about my poor english
    Hi
    I need to get info from an jpeg or any format of image file. for example a form with slectable tems.
    The other way i have is to control a scanner and when im scanning the form get the info. i dont know if there is any api for this.
    Thanx

    look in ImageIcon api
    http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/ImageIcon.html
    in the Method Summary
    + the upper class
    http://java.sun.com/j2se/1.5.0/docs/api/javax/accessibility/Accessible.html

  • IChat Error: "Can't get video from the camera"

    When I try to Screen Share with iChat on a local network, I receive the error "Can't get video from the camera" when I have an external camera plugged into the FW400 port on my Mac Mini. The Screen Sharing feature works great when the camera is not connected. Anyone know why this is and how to fix it?

    Tell us about the Network you created please.
    What make and model modem ?
    Can it route (issue IPs) ?
    IS there a router ?
    Make and model of that please ?
    If there are two devices which is doing DHCP if any are ?
    IS there any computer that is sharing it's Internet Connection with any other computer ?
    I take it from the title and the post that you infer you can Video and Audio chat ?
    The Cannot get Video from Camera normally gets and Error Log pop up.
    This can be opened with the reveal triangle on the left. The Details shown will have a Error number. Do you know what this log says ? (normally Error 20 or 21)
    Old logs are stored in Users/(your account)/Library/Logs/iChatConnectionErrors by date.
    IF you post an Error Log stop at the line that Says "Binary Images for iChat" as we don't need the bits below that yet.
    As the Screen share in iChat uses an Audio component then the Camera if it is also the Mic needs to be ON.
    In your case this may mean that in the ichat Video Menu both Camera Enabled and Mic Enabled should both be ticked.
    (I have never seen an iChat error code for not (specifically) being able to get the Mic input so the message might be the only one iChat can pop up)
    It does seem very odd that it only effecting Screen Sharing.
    I have a Firewire connected DV converter that has two Firewire ports itself so I can input the camera feed to two computers. When this is in place the System also sees it as a Network.
    I have also heard of one person with a Firewire Stills camera and I think the Storage space was seen as an External Device and therefore appeared Networked which is why I asked the first set of questions.
    iChat does not like being in Two networks (a modem that issues IP address and a router doing the same or Wireless to a neighbour and Ethernet to your Own Internet connection, the Mac being the hub in a Share Internet connection, Wireless and Ethernet to the same router and using Parallels when set to Share the Mac's IP are the most common)
    The Screen Sharing option in iChat > Video Menu is ON ? (at both ends ?)
    As iChat's Screen Sharing is related to the System Screen Sharing and therefore Apple Remote Desktop you may find that in any routing device you may have to open ports 5900 and 5988 if not using UPnP
    http://support.apple.com/kb/TS1629?viewlocale=en_US
    You said Local Network. Do you mean this is using the Bonjour Buddy List ?
    11:21 AM Saturday; June 14, 2008

Maybe you are looking for

  • Can I use my iMac as a display for a Dell laptop?

    I have a 27" 2011 imac that I would like to use periodically as a monitor for my Dell Latitude E7240. Can I do this? Thank you.

  • I cannot print a document I created on the Beta of Pages through iCloud.

    I have an iMac Mid 2007.  I have installed OS X Yosemite, Version 10.10.l  I created a document on Pages, and was unable to access it.  I accessed it via iCloud, the Beta Version of Pages, and was able to edit it.  Now I cannot print it.  Any suggest

  • Problem when exporting and importing project from odi 10g to odi 11g

    Hi, I want to migrate my project from odi 10g to odi 11g. But when i am importing the interface then it is giving the error of mising references . I have exported the project(without its child component),models (including my datastore),KM's,folder (w

  • Sending mail from apex appliocation

    Dear friends Can anyone please tell me how to send mail from apex application to outside mail like gmail or yahoo i have one report created which i want to send it to my mail from apex Please hepl me....

  • Error is code

    Hi, I am not getting no results from the following code. It was working satisfactorily but I am not sure why its not working. I think some thing is missing or commented out wrong. What needs to corrected to work again. Normally it commented out when