Results 1 to 3 of 3

Thread: Guidance on programming assignment

  1. #1
    Join Date
    Aug 2007
    Ubuntu 7.10 Gutsy Gibbon

    Question Guidance on programming assignment

    Hello everybody,

    I'm a first year college student (CS major ), and I've received a small project that I need to complete by Friday. It revolves around manipulating photos. Information about the project can be found at the pdf file below:

    I was kind of stumped on the "black and white" effect. At first, I thought I'd just take the average of the RGB values for each pixel, then, depending on whether or not it's greater than some threshold (I decided on 127, the halfway point between 0 and 255), setting each pixel's RGB values to 0 or 255.

    I started thinking more about it, and I was and white photos are usually more of a gray shade - instead of making each pixel purely black or white, am I supposed to merely lighten or darken the shade of each pixel?

    I'm not searching for anyone to write the code for me - I just want to get some feedback/constructive criticism on my current method.

    Many thanks in advance!
    Ubuntu user 22952

  2. #2
    Join Date
    Sep 2009
    Ubuntu 10.10 Maverick Meerkat

    Re: Guidance on programming assignment

    You probably want a 'greyscale' effect.

    For each pixel you could do something like:
    red = green = blue = integer(average(red, green, blue))
    DMedia - Distributed Media Library
    LaVida - A simulation game for Linux

  3. #3
    Join Date
    Mar 2007

    Re: Guidance on programming assignment

    A more interesting method is to do a one-bit quantization of the pixels to either black or white and dither it.

    Note: there are various measures of how a color's lightness. You'll have to pick one. The previous poster gives a simple measure. See
    Last edited by PandaGoat; September 2nd, 2010 at 10:05 PM.


Posting Permissions

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