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

  • SEARCH
  • Home
  • 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 8586283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:16:27+00:00 2026-06-11T22:16:27+00:00

I have a BufferedImage using an IndexColorModel to display some graphics data which uses

  • 0

I have a BufferedImage using an IndexColorModel to display some graphics data which uses a palette. I then draw to the buffer using createGraphics(), and I want to turn this data back into an array of indicies. However, all methods I can find get me RGB values, not the actual index values. This seems a bit silly, since while I could just iterate through my palette and find the proper color, it’d be much simpler to just grab the value directly.

Is this even possible without finding it manually?

  • 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-11T22:16:29+00:00Added an answer on June 11, 2026 at 10:16 pm

    If you can’t modify/override createGraphics() method (because belonging to an external JAR library with no sources), you effectively have to find your object manually.

    Otherwise, if you have access to createGraphics() source code, two choices:

    • If some method clients need indexes as returned object whereas other clients need RGB values as returned, you could build a HashMap<Integer, RGB> as return. Integer would be the index and RGB either an Object itself or a primitive value like a String.

    • If you effectively have found a way to access method’s source code and confirms that index is the essential required data for your process, simply returns an Integer => the index, so that you can grab your targeted objects at O(1).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have these several images which I need to be combined using BufferedImage in
I have a JFrame in which I am using Graphics2D to draw a VolatileImage
I have a BufferedImage with an IndexColorModel. I need to paint that image onto
I have multiple transparent BufferedImage instances which I'd like to layer on top of
I have a java se 6 application which receive between 10 and 15 BufferedImage.
I have managed to load in an image using: BufferedImage image = ImageIO.read(out); and
I have a custom report which draws via Graphics2D , and uses a lot
I have a BufferedImage with alpha transparency, which I need to save as GIF
I have some problems with rotating images in Java using the AffineTransform class. I
I have a program which rescales images using the mortennobel image library for the

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.