Change contrast in Java BufferedImage

Posted on 2011-05-05
Last Modified: 2013-11-23
I need to change the contrast (and maybe the brightness) of an image in Java. It is a BufferedImage that I create, and it is made of different geometrical items. I have to change the contrast of only some of these items. The items to be changed are all of the same color.
Also, these elements are traslucent, so I am using Transparency.TRANSLUCENT function.
I don't know how contrast and transparency interact...

Question by:v_alev
    LVL 92

    Expert Comment


    Author Comment

    But I have to change the contrast of only one color relative to the background, not all the image.
    Can you suggest a way to do that?
    LVL 92

    Expert Comment

    you can just change the color table (ColorModel) of the image to achieve that

    Author Comment

    Can you be more specific?
    Which is the part of the code that influence the contrast?
    Also, do you know how transparency and contrast interact?
    LVL 92

    Accepted Solution

    Contrast multiplies colour values by a scale factor.
    It has nothing to do with transparency

    you can achieve it by using either a RescaleOp, or by adjusting the colour mappings in the colour table
    LVL 59

    Expert Comment

    by:Kevin Cross
    This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    how to use external config file with Spring MVC 4 37
    changeXy challenge 13 40
    array6 challenfge 6 48
    endX challenge 2 32
    For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
    An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
    Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
    This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now