Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8265719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:54:12+00:00 2026-06-08T04:54:12+00:00

I know the java code for grayscale is this( 0.2126 * red + 0.7152

  • 0

I know the java code for grayscale is this( 0.2126 * red + 0.7152 * green + 0.0722 * blue(
I was wondering if anyone knows how I can find more variety of coloring formulas, like if i want to make the picture old fashion way, more orange, make it brighter, or darker … sharper and so on

 int pixel = image.getRGB(j, i);
 int red = (pixel) & 0xff;
 int green = (pixel >> 8) & 0xff;
 int blue = (pixel >> 16) & 0xff;
 int newPixel = (int) (0.2126 * red  + 0.7152 * green + 0.0722 * blue);
                    image1.setRGB(j, i, newPixel);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T04:54:14+00:00Added an answer on June 8, 2026 at 4:54 am

    The old fashion way you mention is called “sepia” effect. Take a look at this question particularly this answer which points out to the following code snippet (note that I did not write this code, just helping out in finding answers to your question)

    /**
    *
    * @param img Image to modify
    * @param sepiaIntensity From 0-255, 30 produces nice results
    * @throws Exception
    */
    public static void applySepiaFilter(BufferedImage img, int
    sepiaIntensity) throws Exception
    {
    // Play around with this. 20 works well and was recommended
    // by another developer. 0 produces a grey image
    int sepiaDepth = 20;
    
    int w = img.getWidth();
    int h = img.getHeight();
    
    WritableRaster raster = img.getRaster();
    
    // We need 3 integers (for R,G,B color values) per pixel.
    int[] pixels = new int[w*h*3];
    raster.getPixels(0, 0, w, h, pixels);
    
    // Process 3 ints at a time for each pixel. Each pixel has 3 RGB
    colors in array
    for (int i=0;i<pixels.length; i+=3)
    {
    int r = pixels[i];
    int g = pixels[i+1];
    int b = pixels[i+2];
    
    int gry = (r + g + b) / 3;
    r = g = b = gry;
    r = r + (sepiaDepth * 2);
    g = g + sepiaDepth;
    
    if (r>255) r=255;
    if (g>255) g=255;
    if (b>255) b=255;
    
    // Darken blue color to increase sepia effect
    b-= sepiaIntensity;
    
    // normalize if out of bounds
    if (b<0) b=0;
    if (b>255) b=255;
    
    pixels[i] = r;
    pixels[i+1]= g;
    pixels[i+2] = b;
    }
    raster.setPixels(0, 0, w, h, pixels);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(Yes I know I can call Java code from Scala; but that is pointless;
I know that Java code can call C++ code through JNI. Is it possible,
Confused by java compilation process OK i know this: We write java source code,
Does anyone know the C# equivalent for the following java code? int offset =
Possible Duplicate: Can anyone recommend a simple Java web-app framework? I want to know
I would like to know the translation of this java code in C# n
I want to know How i can get access via java code to the
can anyone help me with a simple java code example that shows me how
I want to know if it is possible to write java code in android
I know Jython converts Python code into Java byte code, but are there any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.