SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)

    Use js to alter pixels in image.

    Evening all,
    I have an image which I would like to manipulate using javascript. (Given up on flash!)

    What I need to do is adjust the contrast of the image, to do this I need to increase/decrease the amount of white and black pixels within the image.

    Can javascript do this? After much searching I know that js can create color pickers etc but can I use it to alter the contrast??
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  2. #2
    SitePoint Addict
    Join Date
    Aug 2007
    Posts
    365
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think there is a CSS style which you can use to change "effects" of a image,
    cant remember the style. You could try asking in the CSS forum, Ill do some research tonight, If i get a change.

    Also you could try and place a black image behind the picture, and change the opacity, or a white to brighten the image.. Just an Idea

  3. #3
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can "probably" do it in IE using css filters.

  4. #4
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    The IE filter is the opacity one which has the effect of altering the brightness as the images are on a white background.
    What I need to do is change the contrast of the image.
    I could do it in php using imagemagick but because it needs to be done in real time this isn;t an option!!!
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  5. #5
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, flash (version 8 and up) with its powerful bitmap tools is exactly the right tool for this. In javascript, at least in a cross-browser way, this is not possible. You can have a look at http://msdn2.microsoft.com/en-us/library/ms532853.aspx, but I guess this is not what you want.

  6. #6
    SitePoint Addict
    Join Date
    Aug 2007
    Posts
    365
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, misread your post. Would a java solution we an option?

  7. #7
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    @stereofrog - Flash would indeed be the better tool for the job but time constraints, budget and personal ability (mine!) restict me.

    @taliesinnz - an applet could be a possible solution but again it's not something I know anything about!

    Thanks for the replies guys, I might need to have a rethink about the way this works
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....


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
  •