×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Aug 2008
    Location
    Gurgaon, India
    Posts
    155

    Unhappy how to get alpha,red,green,blue values of an image

    how to get alpha,red,green,blue values from getRGB() in j2me in respective arrays.
    Vineet Billorey "The Great"

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: how to get alpha,red,green,blue values of an image

    PHP Code:
    int width img.getWidth();
    int height img.getHeight();
    int[] pixels = new int[width height];
    img.getRGB(pixels0width00widthheight);

    byte[] alpha = new byte[pixels.length];
    byte[] red   = new byte[pixels.length];
    byte[] green = new byte[pixels.length];
    byte[] blue  = new byte[pixels.length];

    for (
    int i 0pixels.lengthi++) {
        
    int pixel pixels[i];
        
    alpha[i] = (byte)(pixel >> 24);
        
    red[i]   = (byte)(pixel >> 16);
        
    green[i] = (byte)(pixel >>  8);
        
    blue[i]  = (bytepixel;


  3. #3
    Registered User
    Join Date
    Aug 2008
    Location
    Gurgaon, India
    Posts
    155

    Red face Re: how to get alpha,red,green,blue values of an image

    thanx for ur code.
    Vineet Billorey "The Great"

Similar Threads

  1. --- ???save image problem??? ---
    By ferenn in forum Mobile Java Media (Graphics & Sounds)
    Replies: 6
    Last Post: 2007-10-01, 14:33
  2. Opening a JPEG Image
    By ummarbhutta in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2007-02-15, 06:34
  3. how to cut some part of Image
    By mshouab in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2006-08-04, 09:05
  4. HELP: Mutable Image to Immutable Image?
    By rj_cybersilver in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2005-03-26, 09:58
  5. Nokia Image Converter
    By davidpurdie in forum General Development Questions
    Replies: 0
    Last Post: 2004-02-18, 15:31

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •