Results 1 to 5 of 5
  1. #1
    Prime624 is offline Member
    Join Date
    Feb 2013
    Location
    San Diego
    Posts
    96
    Rep Power
    0

    Default Color Palette Hashtable

    How can I write a BufferredImage to an 8-bit .bmp using indexed colors stored in a <String,Color> Hashtable?

    I've never used Hashtables before, and I didn't know color indexing existed until now, but I can do most other things in java fairly well.

    I'm not looking for code, just the concept, as I really don't know how Hashtables work (although I could figure it out), and I have no idea how color indexing does. I know how to write image files, just not indexed or with a specific number of bits. I am using Hashtables generated from GIMP.

    EDIT: I mainly want to know how to save a BufferedImage as an indexed .bmp.
    Last edited by Prime624; 02-12-2014 at 02:54 AM.

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,610
    Rep Power
    5

    Default Re: Color Palette Hashtable

    Understanding the innards of a hash table is certainly interesting but not really required to use one. A hash table simply stores a value for some provided key. Hash tables are not a new concept so they are well documented. Check out the Oracle tutorials in my signature.

    Regards,
    Jim
    Last edited by jim829; 02-12-2014 at 02:49 AM.
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  3. #3
    Prime624 is offline Member
    Join Date
    Feb 2013
    Location
    San Diego
    Posts
    96
    Rep Power
    0

    Default Re: Color Palette Hashtable

    Quote Originally Posted by jim829 View Post
    Understanding the innards of a hash table is certainly interesting but not really required to use one. A hash table simply stores a value for some provided key. Hash tables are not a new concept so they are well documented. Check out the Oracle tutorials in my signature.

    Regards,
    Jim
    I assumed as much about the Hashtables. My question was more aimed at saving a BufferedImage to an indexed .bmp.

  4. #4
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    3,610
    Rep Power
    5

    Default Re: Color Palette Hashtable

    I guess I'm not certain what you want to do exactly. If you are saving images, I would think you would want to use a raster. In your example above, where you have Map<String, Color> would imply you want to assign a name of a color for a specific Color object.

    Regards,
    Jim
    The Java™ Tutorial | SSCCE | Java Naming Conventions
    Poor planning our your part does not constitute an emergency on my part.

  5. #5
    Prime624 is offline Member
    Join Date
    Feb 2013
    Location
    San Diego
    Posts
    96
    Rep Power
    0

    Default Re: Color Palette Hashtable

    Quote Originally Posted by jim829 View Post
    I guess I'm not certain what you want to do exactly. If you are saving images, I would think you would want to use a raster. In your example above, where you have Map<String, Color> would imply you want to assign a name of a color for a specific Color object.

    Regards,
    Jim
    I don't know what exactly I need to do, just what it's called. I was hoping someone here would be somewhat familiar with color indexing. When I saw that GIMP could export the index to a .java file, I assumed that it must be a somewhat common practice.

    EDIT: If no one knows, I wouldn't be too surprised. Had to try though.

    EDIT 2: Finally figured it out. Mostly thanks to these two pages: http://www.webbasedprogramming.com/T...Gurus/ch12.htm http://www.java-gaming.org/index.php?topic=28821.0
    Last edited by Prime624; 02-12-2014 at 06:12 AM.

Similar Threads

  1. Java canvas with palette
    By rcbsports in forum New To Java
    Replies: 1
    Last Post: 11-18-2012, 01:36 PM
  2. How to design a palette that similar netbean's
    By cokoder in forum AWT / Swing
    Replies: 1
    Last Post: 02-08-2012, 07:08 AM
  3. Hashtable question. Getting info from a hashtable
    By sindrem in forum New To Java
    Replies: 4
    Last Post: 01-19-2012, 05:00 PM
  4. netbeans palette
    By ki_ha1984 in forum New To Java
    Replies: 3
    Last Post: 10-03-2011, 09:46 PM
  5. Netbeans's JSF palette
    By jing-yi in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 08-25-2011, 04:57 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
  •