Changing the palette of an image using IndexColorModel

Hi
How can I rapidly and often change the palette of a BufferedImage which uses an IndexColorModel? The only palette changes I want to implement are the colors, not the number of bits, palette size, transparencies or the transparent index.
The IndexColorModel class contains a private field rgb[] which I obviously cannot get a reference of, and two private methods IndexColorModel.setRGBs which only seem to be invoked from within the constructors.
Creating new IndexColorModel instances on the fly when I draw the same images (small icons) lots of times with different palettes (either as animation or as duplicates) creates unnecessary initialization overhead and garbage.
Is there another way to get the same effect?

Does nobody know?
Here is an example of what I'd like to do: http://tinyurl.com/28olro
I want to occasionally change the colors from reds to blue, green, gold or others and I want them to smoothly change.
I just want to know if it's even possible to do elegantly using the current API. I'm thinking of making a full-color MemoryImageSource and using an index->rgb array to translate colors on the fly.
Here's the source code if you want to see what I have: http://tinyurl.com/ywxn5d

Similar Messages

  • I use to be able to rotate my iPhone and change the view of an image, Web page, email, and so on, from portrait to landscape, but after update, I cannot. I can only view in portrait mode. Anybody know what's up with that?

    I use to be able to rotate my iPhone and change the view of an image, Web page, email, and so on, from portrait to landscape, but after update, I cannot. I can only view in portrait mode. Anybody know what’s up with that?

    You need to do the basic troubleshooting steps described in the User Guide, Appendix B.
    Restart phone
    Reset phone
    Restore in iTunes using a backup
    Restore in iTunes as new, without using a backup
    If restoring as new doesn't help, there is a hardware failure in the phone that needs evaluation by Apple.

  • Changing the color of an image in EPS format using Illustrator

    How do I change the color of an image in EPS format using Illustrator? Once I do this how do I change the format of the image from EPS to something I can select onto a website like JPG, JPEG or PNG? I plan to print the image onto a T-shirt.

    start here:
    http://help.adobe.com/en_US/illustrator/cs/using/WS714a382cdf7d304e7e07d0100196cbc5f-6519a .html

  • How can I change the palette of a BufferedImage

    How can I change the palette of a BufferedImage ?
    My image uses an IndexColorModel but I want to use a web safe palette.
    I can't see a way to make a setColorModel() to my image.
    Any ideas ?
    Thanks...

    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import java.net.*;
    import javax.imageio.*;
    import javax.swing.*;
    public class ICMExample extends JComponent {
        private BufferedImage original, copy;
        private Point mouseLocation = new Point();
        public ICMExample(BufferedImage original, BufferedImage copy) {
            this.original = original;
            this.copy = copy;
            addMouseMotionListener(new MouseMotionAdapter(){
                public void mouseDragged(MouseEvent e) {
                    mouseLocation = e.getPoint();
                    repaint();
        public Dimension getPreferredSize() {
            return new Dimension(original.getWidth(), original.getHeight());
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D) g;
            g2.drawRenderedImage(original, null);
            Shape oldClip = g2.getClip();
            g2.clipRect(0, 0, mouseLocation.x, Integer.MAX_VALUE);
            g2.drawRenderedImage(copy, null);
            g2.setClip(oldClip);
        public static void main(String[] args) throws IOException {
            URL url = new URL("http://weblogs.java.net/jag/Image54-large.jpeg");
            BufferedImage original = ImageIO.read(url);
            JComponent app = new ICMExample(original, makeICMVersion(original));
            final JFrame f = new JFrame("Drag mouse over image");
                f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                f.getContentPane().add(app);
                f.pack();
                SwingUtilities.invokeLater(new Runnable(){
                    public void run() {
                        f.setLocationRelativeTo(null);
                        f.setVisible(true);
        static BufferedImage makeICMVersion(BufferedImage original) {
            int w = original.getWidth();
            int h = original.getHeight();
            IndexColorModel icm = createICM();
            BufferedImage copy = new BufferedImage(w, h, BufferedImage.TYPE_BYTE_INDEXED, icm);
            Graphics2D g = copy.createGraphics();
            g.drawRenderedImage(original, null);
            g.dispose();
            return copy;
        static IndexColorModel createICM() {
            byte MAX = (byte) 255;
            byte[] r = {MAX, MAX, MAX, MAX, 0, 0, 0, 0};
            byte[] g = {MAX, MAX, 0, 0, MAX, MAX, 0, 0};
            byte[] b = {MAX, 0, MAX, 0, MAX, 0, MAX, 0};
            return new IndexColorModel(3, 8, r, g, b);
    }

  • How to change the text in your image?

    How do I change the font in my image without changing the image itself?

    When you create text in photoshop and save the resulting image in psd or tiff, the text stays live. Allowing you to edit it later on, which is why it is recommended to save to one of the two formats for archival purposes.
    If your text is live, all you have to do is doube click on the icon in the text layer, that will highlight all of the text for that layer. You can then change the properties of that text. Draging across the text will also highlight only what you want selected, and only that portion will be affected by any changes in its properties.
    If you save to a format like jpg and that is the only copy, you then have to use the selection tools to seperate the text from its background. Once the text is selected, you then need to find away to replace what was underneath, hopefully it a solid color, but only you know, since there are no screen grabs to look at.
    If the background consist of multiple colors, you may have luck using the clone tool, or healing brush, etc. to try to mimic the area around the text. If you have CS5 or CS6 you may even have luck with the content fill feature.
    All I can say is if the text is not live, its going to take time and patience to make it look good. And use this as a learning experience for both learning how to do it the hard way and to save as a psd from now on.
    Good luck.

  • How do I change the background to an Image in the web gallery wizard?

    Im using a flash gallery but I can only change the background colour I can't workout how to change the background to an image. Can it be done?
    Thanks
    Jamie

    Not directly this time, I believe, but by a post web gallery generation hack to the generated files.
    Don
    Don Ricklin, MacBook 2Ghz Duo 2 Core running 10.4.10 & Win XP, Pentax *ist D
    See LR Links list at my
    Blog for related sites.

  • I want to import still images to make a stop motion animation, but when I try to change the duration of still images, it isn't reflected in the timeline.  How can I do this?

    I want to import still images to make a stop motion animation, but when I try to change the duration of still images, it isn't reflected in the timeline.  How can I do this?

    Tonaw,
    If you import your still images using iPhoto, then the time you set for each still, using FCPX Perferences works.
    You can set the durantion from 1 frame to as long as you want them view.
    If you do not use iPhoto to import your stills, the default is 10 sec's.
    FYI: This issue was brought up within a month after FCPX was released. They found out by using iPhoto, you had better control of the amount of time your still was viewed.

  • How do I change the perspective of an image not created in Illustrator?

    I want to change the perspective of an image I created using another program. I want to add this image to a project I am working on using Illustrator, but the perspective is off.

  • How to change the default JAD Icon image in JStudio

    Dear friends,
    I have one dought,how to change the default icon JAD image in jstudio application.Its very important to me.And one find answer please tell .

    Dear friends,
    I developed one application in jstudio.And need to set an special icon for my application.While i download my application in to mobile. The icon should be displayed in the mobile.To show my application as unique from other applications.But i dont know how to set an icon for my application. If any one find answer please reply as soon as possible.
    Thank you

  • How to change the bar chart rendering image format in SSRS

    Hello all,
    I am working with SQL Server 2008 R2 and I have a SSRS bar chart report, when the report got rendered over online or if the take Export (PDF and PPT), the image is in png format always, which is taking too much of time to execute the report in case of large
    data.
    Can, It be possible that the rendered image is in jpeg format instead of png.
    If Yes, please share the appropriate steps to follow:
    Thanks in advance
    Pankaj Kumar Yadav-

    Hi Pankaj067,
    According to your description, you want to change the bar chart rendering image format as JPEG format when previewing the report or exporting to a PDF file .
    In Reporting Services, the chart rendering image format is PNG by default. It’s a by-design behavior. And it doesn’t open any API for us to change the image type when exporting a chart to a format. So in your scenario, your requirement can’t be achieved
    in Reporting Services currently. I would recommend you submit a feature request to Microsoft at this site:
    https://connect.microsoft.com/SQLServer. So that we can try to modify and expand the product features based on your needs.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • I need help changing the account number my daughter uses for payment for her apps and itunes, etc. can anyone talk me through this.

    hi ,
    im just a mom, not very computer savy.....however, I need to change the payment method my daughter uses to purchase things on her ipad due to the fact that the current one is expiring. ie: for such things like songs and games, etc.
    I would appreciate any help as how to do so.
    THanks

    On a computer's iTunes you should be able to edit the payment info by going into the Store > View Account menu option (if you are not logged into the account that your daughter is using then Store > Sign menu option to log out of the currently logged in account ; that will then change to a Store > Sign In option so that you can log into her account) and log into the account (enter the account's password and click View Account on the popup)
    And on the account's details page there should be a payment link.
    If you are doing it on your iPad then tap on your id in Settings > iTunes & App Store (if not logged into her account then log out of your account via the popup that you get and then log in with her account) and tap on 'View Apple ID' on the popup and log into the account  - that should also give you a payments link on your account's page.
    Changing payment info : http://support.apple.com/kb/HT1918

  • How to change the password of a schema using Oracle SQL Developer

    Hi need to change the password of a schema using Oracle SQL Developer how do i do it?

    Hi
    alter user username identified by password

  • In the old Numbers I could change the colour of a checkbox using rules - I cannot seem to do this in new Numbers 2013?

    In the old Numbers I could change the colour of a checkbox using rules - I cannot seem to do this in new Numbers 2013?
    I have an old Numbers sheet where I could make the checkbox Cell go Green when ticking "Equal to" TRUE. When I open the old sheet it into new iWork it functions correctly. But I am unable to copy or paste the rule - nor recreate it.
    Any suggestions on how to create a Conditional checkbox cell that goes green once ticked would be most apprecicated.
    Thanks - Steve

    Numbers 3.0 is missing the logic-based "equal to TRUE" or "equal to FALSE" conditions for conditional formatting.  The replacement is text based: "text is TRUE" or "text is FALSE".  You can apply these rules to cells formatted as checkboxes.

  • Change the name of an image file in Photos app

    Just wondering how you change the name of an image file in the new 2015 Photos app?

    The only way to change the filename of an image is to export the image with a new filename:  When exporting you can select the title a s a new filename.
    Then reimport the renamed file to Photos and delete the original version.

  • When I download Microsoft word documents (if have word 2007), I have somehow changed the settings and it downloads them in wordpad, and the format is very bad and I can't read a lot of the document. How do I change the default setting back to using Micro

    When I download Microsoft word documents (if have word 2007), I have somehow changed the settings and it downloads them in wordpad, and the format is very bad and I can't read a lot of the document. How do I change the default setting back to using Microsoft Word 2007 to open these documents?
    == This happened ==
    Every time Firefox opened
    == about a few weeks ago - I had tried to open some docuuments saved on a mac, my PC (which runs Windows 7), used word pad to open these, and this seems to have changed the default settings somehow.

    See this:
    [http://support.mozilla.com/en-US/kb/Managing+file+types]

Maybe you are looking for

  • "Moo" = Right fan repeatedly spinning up and down under certain conditions

    I am pretty certain I have figured out what is causing the "moo". Here is my theory based on a couple of weeks of experimentation... It is the right fan starting up and stopping. Again..and again...and again. It does this in response to temperature c

  • EDIT will not open in PSE 10

    I am not able to EDIT from the welcome screen.  I have been able to in the past, but not for the last 2 days.  I can open the Organizer. Any suggestions? thank you

  • Unknown error on file conversion

    New to Acrobat Plus today. Not impressed. I have the correct system requirements. First .pdf to .ppt conversion yielded "An unknown error occurred." Dead. What now? Also, is THIS what Adobe calls customer service? I'm sure it saves them lots of money

  • Obtaining monitor lock of a blocked thread

    Is there a way to obtain the monitor lock (reference to the object) of a blocked thread? Something like Object Thread.getMonitorLockedObject()Also when you get the locked object it would be useful if you can get reference to the thread which is holdi

  • Firfox offers unwanted alternatives when I begin to input a user name.

    When I input a user name for yahoo or gmail, Firefox offers alternatives that I have previously input. So I get a list of typos and sometimes my password concatenated to the user name. == This happened == Every time Firefox opened == I started using