Count pixels

Discussion in 'Java' started by TheC0der, Aug 23, 2006.

  1. TheC0der

    TheC0der Guest

    Hello everybody!
    I need to know how many white(or other colors) pixels are in Graphics,
    but i didnt found way :(. I see that there is solution for Image, but
    this cant help me.
    I have one more question - (may be is silly) How to copy Image to
    Graphics and Graphics to Image?
    Thanks for your attention.
     
    TheC0der, Aug 23, 2006
    #1
    1. Advertising

  2. Hi,

    TheC0der wrote:
    > Hello everybody!
    > I need to know how many white(or other colors) pixels are in Graphics,
    > but i didnt found way :(. I see that there is solution for Image, but
    > this cant help me.
    > I have one more question - (may be is silly) How to copy Image to
    > Graphics


    g.drawImage();

    > and Graphics to Image?


    AFAIK impossible. The solution is to create an Image, to get its
    Graphics and to paint on this graphics.

    Hth,
    Ingo
     
    Ingo R. Homann, Aug 23, 2006
    #2
    1. Advertising

  3. TheC0der

    Josh Falter Guest

    Disclaimer: There may be a slick way to do the counting of white
    pixels, but off the top of my head I know that java.awt.Robot has a
    getPixelColor(x,y) function that you could use if you got desperate.
     
    Josh Falter, Aug 24, 2006
    #3
  4. TheC0der

    Oliver Wong Guest

    "TheC0der" <> wrote in message
    news:...
    > Hello everybody!
    > I need to know how many white(or other colors) pixels are in Graphics,
    > but i didnt found way :(. I see that there is solution for Image, but
    > this cant help me.
    > I have one more question - (may be is silly) How to copy Image to
    > Graphics and Graphics to Image?


    Think of the Graphics object as a pen, and the Image object as a sheet
    of paper. You use the Graphics object to draw on the Image, just like you
    use a pen to draw on a paper. However, the Graphic object itself does not
    store the picture your drew, just like the pen doesn't store the picture.
    The picture is stored on the paper, or the Image object.

    - Oliver
     
    Oliver Wong, Aug 24, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rashmi Panduranga

    Relation between Points & Pixels

    Rashmi Panduranga, May 16, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    3,651
    Rashmi Panduranga
    May 17, 2005
  2. Vishal Gupta

    text length in pixels

    Vishal Gupta, Jan 19, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    3,103
    Rick Lemons
    Jan 20, 2004
  3. Trint Smith
    Replies:
    2
    Views:
    372
    Brad Williams
    Feb 17, 2004
  4. =?Utf-8?B?SmVyZW15IERhdmlz?=

    RE: String Length in Pixels

    =?Utf-8?B?SmVyZW15IERhdmlz?=, Sep 16, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    454
    =?Utf-8?B?SmVyZW15IERhdmlz?=
    Sep 16, 2004
  5. efelnavarro09
    Replies:
    2
    Views:
    980
    efelnavarro09
    Jan 26, 2011
Loading...

Share This Page