Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Grey Scale?

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Thanked 0 Times in 0 Posts

    Default Grey Scale?

    Hi I'm new to coding and dont really know that much, but I have a homework assignment where I'm suppose too create a "sophisticated grey scale" instead of add up all the red, green, and blue pixel and then dividing it by 3.

    It says "obtain the new RGB values, instead of adding up the color values and diving by three, you should multiply each one by a weight factor and add the results."

    This is what I have so far and not sure where to go from here.
    import images.*;
    public class SophisiticatedGreyScale
        public static void main (String args[])
            APImage image = new APImage("smokey.jpg");
            APImage aCopy = image.clone();
            for (Pixel p:aCopy)
            }//end for loop
        }//end method main
    }//end SophisiticatedGreyScale

    Any help would be appreciated ^___^!

  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Thanked 833 Times in 772 Posts
    Blog Entries

    Default Re: Grey Scale?

    Search the internet for the word 'grayscale'. One of the first hits should be the corresponding wikipedia page, which has the equation for weighting each RGB component to get the corresponding grayscale value.

Similar Threads

  1. Rate this code on a scale from 1 - 10 and please suggest some improvements.
    By BurningCa007 in forum What's Wrong With My Code?
    Replies: 15
    Last Post: March 14th, 2013, 10:31 PM
  2. How to scale the scrollpane's Vvalue
    By Jacques_ZA in forum What's Wrong With My Code?
    Replies: 0
    Last Post: January 25th, 2013, 02:05 AM
  3. get gray scale value from 16-bits image
    By div111 in forum Java Theory & Questions
    Replies: 1
    Last Post: January 16th, 2013, 08:52 AM
  4. [SOLVED] Scale Numbers from 0.0f to 1.0f
    By techwiz24 in forum Java Theory & Questions
    Replies: 1
    Last Post: September 23rd, 2011, 09:50 PM