Results 1 to 3 of 3
  1. #1
    od11kd is offline Member
    Join Date
    Nov 2012
    Rep Power

    Default Converting image into a "night time" effect (changing pixels colors)

    Hey guys!

    So I have to convert an image into a night time view.

    Here is what the questions asks:

    The night-time effect is created by modifying each pixel’s color based on how different (far) it is from “sky-blue” (Color(58,117,197)). For each pixel, the color distance between the pixel’s color and “sky blue” is computed. Each color channel of the pixel is modified by the ratio of this distance value and 311 (the maximum distance) such that “sky-blue” becomes black (the ratio is 0) and the color most distance from “sky-blue” remains unchanged (ratio is 1).

    I have NO clue of what to do or where to start.

    Any and all help is greatly appreciated!

    Thank you so much in advance!

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default Re: Converting image into a "night time" effect (changing pixels colors)

    I'd have a look at the BufferedImage API to get started.
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Voorschoten, the Netherlands
    Blog Entries
    Rep Power

    Default Re: Converting image into a "night time" effect (changing pixels colors)

    For every color (r, g, b) compute the distance w.r.t. (57, 117, 197); let this distance be 'd'. Next computer (r*d/311. g*d/311, b*d/311) (*) and voila.

    kind regards,


    (*) 311.5397245938 to be more accurate.
    Build a wall around Donald Trump; I'll pay for it.

Similar Threads

  1. Replies: 3
    Last Post: 10-30-2012, 03:06 PM
  2. Changing the color of "setToolTipText"
    By Y. Progammer in forum New To Java
    Replies: 7
    Last Post: 02-27-2010, 06:53 PM
  3. Changing colors of an image in real time
    By chale in forum CLDC and MIDP
    Replies: 0
    Last Post: 05-06-2009, 03:04 PM
  4. Replies: 0
    Last Post: 11-22-2008, 01:49 AM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Posting Permissions

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