Identify the Color of an Image

Discussion in 'Python' started by Monyl, Jul 14, 2010.

  1. Monyl

    Monyl Guest

    Hi,

    1. How can I find the color of an image present the webpage?

    2. How to identify the font type of the selected text present in the
    content of the web page

    It would be much helpfull, if anyone responds to it ASAP

    Thanks
    Mohmyda
    Monyl, Jul 14, 2010
    #1
    1. Advertising

  2. Monyl

    Gary Herron Guest

    On 07/14/2010 05:37 AM, Monyl wrote:
    > Hi,
    >
    > 1. How can I find the color of an image present the webpage?
    >
    > 2. How to identify the font type of the selected text present in the
    > content of the web page
    >
    > It would be much helpfull, if anyone responds to it ASAP
    >
    > Thanks
    > Mohmyda
    >




    Please be clearer about what you want.

    1. An image does not "have" a color, although each pixel in an image
    does have a color.

    2. Text in a web page does not (necessarily) have a font, although the
    display engine will use a font of its choice to render text. And my
    browser will probably use a different font than yours.
    Gary Herron, Jul 14, 2010
    #2
    1. Advertising

  3. Monyl

    John Nagle Guest

    On 7/14/2010 5:37 AM, Monyl wrote:
    > Hi,
    >
    > 1. How can I find the color of an image present the webpage?
    >
    > 2. How to identify the font type of the selected text present in the
    > content of the web page
    >
    > It would be much helpfull, if anyone responds to it ASAP
    >
    > Thanks
    > Mohmyda


    "Selected text"? Selected how? "Selected" implies some form
    of user interface, like a browser. If you're doing something in
    a browser, look into Firefox and Greasemonkey.

    John Nagle
    John Nagle, Jul 14, 2010
    #3
  4. Monyl

    Monyl Guest

    On Jul 14, 9:01 pm, John Nagle <> wrote:
    > On 7/14/2010 5:37 AM, Monyl wrote:
    >
    > > Hi,

    >
    > > 1. How can I find thecolorof  animagepresent the webpage?

    >
    > > 2. How to identify the font type of the selected text present in the
    > > content of the web page

    >
    > > It would be much helpfull, if anyone responds to it ASAP

    >
    > > Thanks
    > > Mohmyda

    >
    >      "Selected text"?  Selected how?  "Selected" implies some form
    > of user interface, like a browser.  If you're doing something in
    > a browser, look into Firefox and Greasemonkey.
    >
    >                                 John Nagle


    I will be using a automation tool called Sikuli and select the text or
    an Image.

    My Requirement
    ---------------

    I will capture the image manually and scriptify using Sikuli. To find
    the captured image in the web page. Once it finds the image I need to
    collect the information of the image like,

    Co-ordinates of the image, height and width, color and pixel rate of
    the image.

    If I want to search a particular text in a webpage. I need to find the
    font name, type, color and size of the text.

    Note :- We can open the web page in any browser. but I should be able
    to capture the attributes of the image/Text displayed.
    Monyl, Jul 15, 2010
    #4
  5. Monyl

    Monyl Guest

    On Jul 14, 8:51 pm, Gary Herron <> wrote:
    > On 07/14/2010 05:37 AM, Monyl wrote:
    >
    > > Hi,

    >
    > > 1. How can I find thecolorof  animagepresent the webpage?

    >
    > > 2. How to identify the font type of the selected text present in the
    > > content of the web page

    >
    > > It would be much helpfull, if anyone responds to it ASAP

    >
    > > Thanks
    > > Mohmyda

    >
    > Please be clearer about what you want.
    >
    > 1. Animagedoes not "have" acolor, although each pixel in animage
    > does have acolor.
    >
    > 2.  Text in a web page does not (necessarily)  have a font, although the
    > display engine will use a font of its choice to render text.  And my
    > browser will probably use a different font than yours.


    Hi Gary Herron,

    1.If I am going to click on a particular image. I will have click
    using the co-ordinates of an Image. Can we find the color of the pixel
    which lies in that particular co-ordinate where I click.

    2.I just want to retrive the attributes of the text as it appears on
    the browser. Can I get the font value depending on the browsers.

    Hope you understand my problem.
    Monyl, Jul 15, 2010
    #5
  6. On Wed, 14 Jul 2010 23:56:27 -0700 (PDT), Monyl <>
    declaimed the following in gmane.comp.python.general:


    >
    > I will capture the image manually and scriptify using Sikuli. To find
    > the captured image in the web page. Once it finds the image I need to
    > collect the information of the image like,
    >
    > Co-ordinates of the image, height and width, color and pixel rate of
    > the image.
    >

    Images only have coordinates WHEN RENDERED BY a browser... And those
    coordinates will change if the browser changes size, or font size, etc.

    Height and Width may be whatever the image file contained, OR
    whatever was defined in an IMG tag if the browser has the ability to
    scale images during rendering. "color and pixel rate" don't make any
    sense... GIF format files use a look-up table of 256 colors, and the
    "pixels" consist of 8-bit index values into that look-up table.

    Normally image /references/ will be found by parsing the HTML for
    <IMG ...> tags, then finding the SRC attribute and extracting the URL of
    the image file... Retrieving the image file is a separate step from
    retrieving the main HTML... This presumes you don't want to also find
    images tiled as a background, as those are specified in different tags.

    > If I want to search a particular text in a webpage. I need to find the
    > font name, type, color and size of the text.
    >

    Again dependent upon the browser... I can set my browser to ignore
    any font specifications in the HTML and use just a font I choose... Or
    let it use which ever is available on my machine from a list it
    specifies as metadata.

    > Note :- We can open the web page in any browser. but I should be able
    > to capture the attributes of the image/Text displayed.


    Does the browser support access from external programs? Then you are
    probably looking at accessing the DOM data structure the browser uses
    internally.
    --
    Wulfraed Dennis Lee Bieber AF6VN
    HTTP://wlfraed.home.netcom.com/
    Dennis Lee Bieber, Jul 16, 2010
    #6
  7. On 07/15/2010 09:13 AM, Monyl wrote:
    >> Please be clearer about what you want.
    >>
    >> 1. Animagedoes not "have" acolor, although each pixel in animage
    >> does have acolor.
    >>
    >> 2. Text in a web page does not (necessarily) have a font, although the
    >> display engine will use a font of its choice to render text. And my
    >> browser will probably use a different font than yours.

    >
    > Hi Gary Herron,
    >
    > 1.If I am going to click on a particular image. I will have click
    > using the co-ordinates of an Image. Can we find the color of the pixel
    > which lies in that particular co-ordinate where I click.


    You haven't even told us which platform you're talking about.

    This is a highly platform specific problem.

    >
    > 2.I just want to retrive the attributes of the text as it appears on
    > the browser. Can I get the font value depending on the browsers.


    If you want to know which font a browser is using to render something,
    you'll have to, essentially, ask the browser!

    I doubt this is something any browser would support, as it's hard to
    imagine *any* practical use case. Should be possible by extending
    firefox. (or any open source browser)

    >
    > Hope you understand my problem.


    Not really.
    Thomas Jollans, Jul 16, 2010
    #7
  8. On Wednesday 14 July 2010 23:56:27 Monyl wrote:
    >
    > I will be using a automation tool called Sikuli and select the text or
    > an Image.


    It sounds to me like this is a question not about Python, but about Sikuli. I
    suggest you ask the question at https://answers.launchpad.net/sikuli or on their
    mailing list at https://lists.csail.mit.edu/mailman/listinfo/sikuli-users .

    >
    > My Requirement
    > ---------------
    >
    > I will capture the image manually and scriptify using Sikuli. To find
    > the captured image in the web page. Once it finds the image I need to
    > collect the information of the image like,
    >
    > Co-ordinates of the image, height and width, color and pixel rate of
    > the image.
    >
    > If I want to search a particular text in a webpage. I need to find the
    > font name, type, color and size of the text.
    >
    > Note :- We can open the web page in any browser. but I should be able
    > to capture the attributes of the image/Text displayed.


    ----
    Rami Chowdhury
    "Ninety percent of everything is crap." -- Sturgeon's Law
    +1-408-597-7068 / +44-7875-841-046 / +88-01819-245544
    Rami Chowdhury, Jul 16, 2010
    #8
    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. vijay
    Replies:
    0
    Views:
    452
    vijay
    Jun 26, 2006
  2. Daniel Mark

    py2exe: cannot identify image file

    Daniel Mark, Aug 19, 2006, in forum: Python
    Replies:
    1
    Views:
    712
    Michele Petrazzo
    Aug 21, 2006
  3. Replies:
    2
    Views:
    1,642
    Fredrik Lundh
    Aug 20, 2006
  4. 88888 Dihedral
    Replies:
    10
    Views:
    483
    Victor Bazarov
    Dec 23, 2011
  5. Kamaljeet Saini
    Replies:
    0
    Views:
    405
    Kamaljeet Saini
    Feb 13, 2009
Loading...

Share This Page