Page 1 of 8 123 ... LastLast
Results 1 to 10 of 72

Thread: color picker

  1. #1
    Join Date
    Mar 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default color picker

    how can i get the color value when we point the mouse on images?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You can't, insofar as I know.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Depending on how important it is, you could use php to do it.
    It would be intense coding, probably beyond most people on the board here, but it IS possible, I think.
    I don't really know how, but, generally,

    You could have the point on which an image was clicked be transferred to a php interpretation page (not sure how, but there's a special way... I think its a default to send coordinates), then use that point to locate the pixel with php.
    Php, in addition to programming and text stuff, can actually create and modify images.
    Php could find that particular pixel of the image, somehow read a color value from it, then print that value to html.

    No idea about using JS, though.

    You could try to make that a JS operation... where you have an iframe or something that's the interpretation php page.. and when it was done, you'd somehow transfer the color code to the other window.

    I dunno... it's complex.



    You could try just making each pixel it's own image... it would be a page, but it's possible... just a lot of handcoding....


    Actually, an imagemap of each pixel would do you more good and save you a bit of time coding...


    How badly do you need it?

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Ah, now that's a good idea. Using PHP and GD with AJAX, this might actually be possible. I hadn't thought of that.
    But yes, it does boil down to:
    How badly do you need it?
    This is one heck of a lot of effort, and not something to be undertaken for the purpose of a minor effect.

    It would be easier to do using Flash or Java, still, as I posted in your other thread.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Hey, Twey... this is a random question, but also helpful for this thread.

    How could you best get php working in a client-side-esque manor?
    Obviously its serverside, but how could you get it to function in realtime, with javascript and the like?
    That's somewhat ambiguous, but just pick an example and go with it or something... I'm curious... wondering how that might work....


    I mean... obviously you could just refresh the page with js/meta and get the php to do itself again... but that doesn't work in many cases.

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    As I said, I'd use AJAX. This allows Javascript to send and receive data to and from a server-side script without refreshing the page. It's not entirely realtime, as there is lag, but it's closer to it than anything else.
    Obviously its serverside
    Unless used client-side. It even has GTK bindings so one can create GUIs with it.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Hmm.... cool.
    But... AJAX isn't anything special... it's just a paricular style of combining languages, right?
    I can always look up more info... no matter right now anyway.


    For a color picker, I'd recommend making one not as a picture, but as a specifically coded thing just for that. Use javascript, create some kind of map and have the point relate to math that will use the coordinate to generate a code. Better yet, make some sliders with JS or something then have those change the values, creating a text box entry with the HTML code for the color. Also use that same value as a dynamic element of the page to show what the color looks like. just use a table and use bgcolor to demonstrate. (Set the table to width/height 50px and should be a nice little 'image'.)

  8. #8
    Join Date
    Mar 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I'm still trying to find the similar example for my problem.

  9. #9
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Hmm.... ok. i'm curious, so post when you find it.

    Question... are you interested in the function of letting someone pick a color to serve that purpose, or actually being able to use any image you want and picking that pixel and the color?... it's very different.

  10. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I've seen image maps used this way but, it would be a pain if not impossible to make each pixel an area. Every block of 4 or 8 pixels might not be too bad if you are fanatical about it or can figure out a way to generate the code.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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