Changing colors in an Image object

I have an Image objects and want all the red pixels in it changed to blue during runtime.
How can I do that?

ImageIcon oldImage = new ImageIcon("C:\\duke\\t1.gif");
ImageProducer producer = new FilteredImageSource(oldImage.getImage().getSource(),new MyFilter());
ImageIcon newImage = new ImageIcon(Toolkit.getDefaultToolkit().createImage(producer));
JLabel jl = new JLabel(newImage);
// Image filter
class MyFilter extends RGBImageFilter{
  public int filterRGB(int x, int y, int rgb) {
    int alpha = (rgb >> 24) & 0xff;
    int red = (rgb >> 16) & 0xff;
    int green = (rgb >> 8) & 0xff;
    int blue = rgb & 0xff + red;
    if (blue>255) blue=255;
    red=0;
    return alpha << 24 | red << 16 | green << 8 | blue << 0;
}

Similar Messages

  • Changing colors of an image in real time

    Hi,
    I am trying to get an image raw data in an int[] array using getRGB() in order to change the color of the image.
    But it is working fine in simulator for any image. if i install it in real device say Nokia 6600 the getRGB() method is not working for large .png image like size (88X57) because the device gets hang while we are using large image but it is working fine for small image.
    Pls give me some idea how to use getRGB() for large image.
    Following is the sample code
    int imageWidth = img.getWidth(); 
    int imageHeight = img.getHeight();
    int[] raw = new int[imageWidth*imageHeight];
    img.getRGB(raw, 0, imageWidth, 0, 0, imageWidth, imageHeight);Thanks in advance

    Use the AI CONFIG to set up your acquisition.
    Use AI CLOCK config to set up your timing.
    Use AI TRIGGER CONFIG to set up your trigger.
    Use AI CONTROL to start the DAQ (use TOTAL SCANS TO ACQUIRE = 0 for unlimited scanning.
    repeat (While loop)
    Use AI READ with a NUMBER of SCANS TO READ = 0. This tells you the backlog (how many scans in the buffer)
    Use AI READ with NUMBER OF SCANS TO READ = to the backlog number from above. (this empties the buffer)
    Process the scans received into your image - append to previous data and re-display.
    If you are doing a fixed number of scans, add this backlog number to the total done so far, and see if you're done. If you're doing continuous, skip this step.
    Wait 100 mSec if you can, 10 m
    Sec if you can't.
    Loop (until # scans done >= # scans wanted OR Quit button, whatever).
    Use AI CONTROL to stop the DAQ.
    The idea is that the DAQ operation happens in the background. You just ask how many are available, and then read that many and use them.
    You wait 100 mSec to allow the display update to happen.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Change colors of interactive image controls

    Hello,
    I seem to be having a problem with the interactive image widget in iBooks author. In the software, and under the template I'm working with, i added some interactive image widgetsvwith always-on controls. Now the controls niceley integrate wth the template by adopting a light blue color.
    However, when i preview the book on my iPad, the controls are dispayed in black which is, in my opinion, much uglier thannblue for this specific template, do you know how this csn be changed ?
    Thank you

    I suspect this repsonse is somewhat mis-leading, the code has no effect on the control other than setting its state, although the route is somewhat tedious for the mod.
    I would imagine that the control is set up so that the pixels didn't move around when they are being used as controls.
    There are nested groups and locks on the controls, which might make the ordering in the cluster easier to manage.
    The following should work....... ;-) it did for me
    Open  your own new VI
    Open the main LCD VI
    Open the Browse VI Hierachy
    Drag and drop the LCD VI onto your own diagram
    Create a cluster from the LCD VI's connector
    Now ungroup the clusters and unlock them (this is tedious) if you create your own then you could be more imaginative in the structure, I leave that for homework.
    Then import a new bitmap (gif) into the control
    Now update the modified contol back into the master control
    ........ Told you it could be done, but I am not sure the pain was worth it.
    BUT
    Try the alternative control..... with colour settings as well, ANY colour and even some size control.
    It was here http://members.lycos.co.uk/sgctek/

  • Changing color of Interactive Image label?

    i'm pretty clear on how to alter the title, caption, border of an Interactive Image, but i'm wondering if there is a way to change the color, orientation and appearance (other than font) for the associated labels? any help would be great. thanks!

    fabe: i totally get that -- and you're right -- a good designer would understand that the labels shouldn't upstage the graphic to which they refer. to that end, i think that effect would be enhanced if you looked at the default screen and simply saw (unboxed) labels, and then when you clicked opn the text, you'd zoom in and the text might even get a little transparent so the graphic is even more accentuated. i also think it would be cool if you could control the default view of the label (change it's colors, characteristics, transparency, etc) and then when setting its zoomed-in view, you'd also be able to change the label's colors, characteristics, transparency, etc, as well. honestly, i'm sort of relieved to know this isn't possible in ibooks author 1.0 (maybe in 2.0?) because i looked and looked AND looked. btw, the app is INCREBIBLY intuitive -- pretty **** remarkable, in fact. you have done an amazing job, so thanks so much! bob (ps: so glad i waited for a great wysiwyg ibook tool -- and that apple released it. i plan in converting a number of my out-of-print books -- and will be using ibooks author!) http://www.bobstaake.com/page5.shtml)

  • Cannot change color of png image in AI

    I downloaded a camera png image (http://simpleicon.com/camera.html) and am trying to change its color to red (B03B28). But the fill box is not working. It shows like the item is red but it will not change. Can the color be changed?

    go back to the download site and get the .svg file--that will open in Illustrator and you can change the color--the only way to change the color with the .png file is in photoshop

  • Changing colors on an image

    hi,
    I have a black and white image. Now I want to change all black dots into a different color. What is the best way to do that?
    thanx,
    Usul

    One solution is to use the ColorConvertOp class.
    Another is to run through the rgb data manually and reset black pixels to the color you want.

  • Change color of entire image?

    I have a damask flourish design in JPEG format.  I want to change the entire color of the design from green to pink.  How can I do that?  I have an older version of Photoshop Elements 6.0 on my Windows XP machine, but can upgrade to 11 on my Macbook Pro.  Any help or advice is appreciated.  Thanks.

  • Changing color on a single object

    I am using FCP 5. Is there an easy way in Final Cut Pro to edit out something like a tie? I was handed a video from one of our vendors and the man is wearing a tie that I have been asked to change the color on. The only way I can find to do it is editing one frame at a time. I do not have that kind of time even if the video is only 60 seconds long. Any advice?

    If the tie is a solid color, you could use a combination of the Chroma Keyer filter and 3 Way Color Corrector. If the tie is much more complex in color and moving around, use a Garbarge Matte to isolate it as well.

  • How to desaturate (or color edit) an IMAGE?

    I have an image imported to Illustrator. Some of JPG files. Now I want to add to my image desaturation 100%.
    Scale of gray, you know what I mean.
    But I didn't see an option to edit that image.
    When I click this: http://prntscr.com/5kpc43 what means "Edit original", my image opens in... Microsoft Paint!
    There must be any option to do that in Illustrator. I can't do this in Photoshop because I would have to do all things from the beginning (scale, rotation, position etc).
    Please, help

    Thanks to everyone for trying to help me.
    1. My pictures are opened by graphics explorers, like IrfanView or standard Microsoft Browser. So I can't do that. Because I don't want after that opening my Image files in Photoshop, no. I want to just edit it one time. I think Illustrator should open my image in Photoshop automatically when I select my image in Illustrator and click "edit image", don't you think?
    2. I work mostly on Corel Draw. It'a also vector software but there we can change color of rasterized images.
    3. Hey, there must be a way to do that in Illustrator. C'mon, this is not a very heavy, complicated thing to do with rasterized image. I want only to DESATURATE it, that's all. I don't beliewe that default Illustrator can't do that simple thing.
    4. Color editing isn't work:
    5. The most important. I know that I can do it all over again but I place my object in "create clipping mask". And put this very carefully etc. So I want just edit a color (desaturate a little bit). Instead I would have to delete this, desaturate in Photoshop, paste this in Illustrator, then create a clipping mask again etc. And after that I think "hmmm, maybe desaturation is a little to much, let's see how it looks like next time" and I will have to do this all over again! No way, there must be option to do this SIMPLE action in Illustrator without aby plugins.

  • Can I change color of all objects at ones ?

    Hello guys
    I understand that's very fundamental question, and I promise I search the forum prior to posting, but perhaps it's my bad english and wrong phrasing, that leads to poor results. So if that has been discuss, please kindly don't waste your time, just link me to the post and I will read away.
    I have very complex file, with hundreds of paths, shapes, text, outlined text,  etc... It's a brochure with graphs, scematich drawings and text.
    Last moment, the client like the reverse the colors from (current) Black on white, to all White on dark gray background.
    Problem is, I can't seem to find easy way to just change the colors, without selecting one by one, every single object. When I selest all and choose white, it start filling paths with solid fill... Editing it wastes allot of my time and I have many pages to do.
    Is there any way to simple change color of everything at once, just from black to white ? Or do I have to go object by object manually ?
    Thank you very much, for all the help so far, and I'm sincerly sorry to waste your time if that has been covered previously.
    Good day
    ciao ciao
    Monika

    Thank you both for such prompt follow up. I know it's just typing and it's easy but I sincerly mean it. Thank you.
    The INVERT work on some images.
    The "SAME" seem to work funny way. When I select STROKE COLOR, it does nothing, but when I select WIGHT then it does and in fact I'm able to change lots of strokes at once with ease. Even tho I'm left with few small bits here and there which I need to change manually, it is certainly far better than doing one by one.
    Thanks a lot for the help, it's what I was looking for.
    By the way   I not once used the SAME menu. Feel so lame, given I use AI (not daily but often) for few years now... Shame.
    Thank you and you guys have a great day
    xoxo

  • How can we change the  color of the image for product display for different

    Hi All,
    How can we change the  color of the image for product display for different colors, to be displayed on site.
    jeff

    Hi priya,
    The requirement that you have stated is not a standard feature in ISA CRM. In order to do the same, you will need to modify the standard ISA code in Java. A common path for the solution would be as follows:
    1. Colours
        a. Maintain a text type for Color under the object - PCAT_ITM in Customizing.
        b. Modify the standard search of ISA to search within your new text type as well. (In standard it only searches in Description.
       c. Maintain all shirts colour data in the new type created in step a.
       d. Your requirement will be done!
    2. Price
      a. Use list prices for your shop and assign the appropriate condition type, acces in your catalog.
      b. Modify the standard search of ISA to search on the list prices as well.
      c. This too will be done!
    3. Accessories - This is very tricky, and will require some exploration. However, here's my opinion,
    a. Search for the standard function module, which will return the accessories when provided the product as an input.
    b. Modify this function module according to your requirement and ensure that it can be accessed remotely.
    c. Modify the JSP as in steps 1b and 2b above to call this new remote-enabled function module.
    d. Now you're done!!
    The ISA modification part is not so simple, you need a really good guy like "Sateesh Chandra" who'll be able to handle your requirements. This is all I could manage, hope it is some help to you!
    Thanks & Regards,
    Nelson.

  • Change color of object

    I have a image I am editing in photoshop CS, I want to replace the black color of an object with blue, I've done this in the past but for some reason the Contrast/brightness tool is not working, I can change the brightness but the object is just staying black. I tried using the magic wand and selecting the object and then fillinf it but that leaves uneven edges.

    Have you tried enabling the tint checkbox? That can be used to add color. (if necessary you can use a selection to create the mask for the hue/saturation/luminance adjustment layer).
    Another solution is to create a selection for the black area, then with a new layer add a mask to it and fill that layer with a color (not necessarily in that order) then you can use a blend mode or opacity to allow any texture to show through if there is any.

  • Images Change Colors between monitors while the UI stays the same

    Hey! Im having an issue where photoshop changes the colors when I move the window between my monitors, seen here: http://sta.sh/04y5s60vf3j This isnt due to the monitors themselves being different, it actually changes after a few seconds of moving it inbetween the monitors. The left one has been callibrated with a spyder 3 elite which I no longer have access to. I applied the file with windows color management instead of the spyder utility. The second one is new, and it is not callibrated by anything, but instead was done by hand with the built in brightness/contrast/custom RGB settings. Both of them are very close to eachother, enough so for my tastes. but when photoshop changes what the image looks like, it's causing problems. Interestingly enough, when I disable callibration for the monitor on the left, the image does not change colors between monitors, but instead always appears as it does on the right. but then they don't match up and the whole screen looked washed out because it's uncallibrated, so that doesnt do me any good. Another interesting thing to point out, is when this image is saved as a .JPG, and viewed with firefox the image appears exactly like the monitor on the LEFT (which is my main monitor) despite the left monitor being the one that is force changed. does anyone have any suggestions? It also appears that windows photoviewer is behaving the same way, though firefox does not. Meaning when I open an image in all 3 on the left monitor, they look the same, but when opened on the right monitor, windows photo viewer and photoshop both display the image as brighter and redder than firefox does. This is frustrating, because it seems photoshop is changing the image with my callibration on my left monitor to match what it looks like on the web, which it does. but it doesn't do this for the right monitor, or when the left is uncallibrated. Another issue I can see with this is even if the UI is the same shade of gray, the images are different between the monitors because of this change. Does anyone have any suggestions?
    - BD

    Alright! So I reread through all this, poked at some things on the internet, and I'm going to attempt to summarize what would be a good solution for all this (And it seems, it still won't be perfect, but to get myself into the best environment I can for not messing with images for an hour trying to make them look nice before I post them to the web. I painted something yesterday on the cintiq, popped it over to my laptop screen and it just looked washed out and terrible.)
    1. Get a X-rite EODIS3 i1 Display Pro, Callibrate laptop and cintiq. I do have the money to drop on something like this, especially if it's a time saver.
         Things I'm not sure about:
              a. There was a ton of complaints about the software not working when I checked reviews, but also a ton that said everything was great. most of them were mac users though.
              b. I'm not sure if problems would still be posed, even while calibrated, by me having a wide gamut monitor.
              c. I'm a terrible excuse for a human being and I think the colors showing up brighter on the wide gamut screen is pretty (I should just make my images this bright on a normal screen and there won't be any issues. >.>)
    2. Set Firefox to color manage (easy enough)
    3. Change my photoshop working space to sRGB (since they'll have been calibrated at this point)
    3. Accept the fact that most of the people who look at my work will be doing so on a monitor that is almost certainly uncalibrated, and I can't control what they will see on my screen, but I CAN control if the colors are -actually- what I want them to be on any properly calibrated device. which is probably the best way to go anyways.
    4. Make paintings, have fun.
    Now, you two have been going on about all sorts of interesting things in here, and it seems that calibration issue run much much deeper than I ever thought. Do either of you have recommendations for how I should tweak this list of things to do or other things I can/ should do? I'm not currently a working professional, but if I have anything to say about it, I will be within a few years (I'm going to school for illustration and studying concept design on my own time) so it'd be useful for me to get into good habits now.
    - Brendavid

  • Splitting a Flattened Image into Layers so I can use the Paint Bucket to change colors

    I have what I think is a flattened image that is part of a Website template. (I'm assuming the image is flattened, because when I use the paint bucket to change the color, it colors the whole thing; and when I use the magic wand, the whole image is selected). I need to be able to use the paint bucket to change the colors. What do I have to do to make the image work that way? The image is made to look like you're looking left to right at four file folders. The folder labels are a different color. Is there some way to separate the folders (now in green), the folder labels (now in yellow), and the white background from each other, so I can apply the paint bucket to different layers later? I've worked on this for hours now, and can't seem to find the answer. I'll have to change the colors in the image at least 10 different times, so I was hoping I wouldn't have to resort to using the brush or pencil tools.

    Darlene,
    Another way is to use the Replace Color Tool. The Hue/Saturation method is probably easier, but I thought I'd mention Replace Color for your information.
    http://www.pixentral.com/show.php?picture=18IBCKnJchzoxfLEaw7Bu93j9W5jS
    In my example I changed the 3rd label in your picture to red.
    1. Roughly select the label using the Lasso tools.
    2. Enchance>Adjust Color>Replace Color.
    3. Click on the label in the picture; it will appear in the box as white on black background. In general you would move the fuzziness slider until just the portion you wish to change appears white. In this case since the yellow is uniform with sharp border the fuzziness slider had minimal additional effect, but I did move it all the way right to capture the fringe pixels.
    4. Play with the 3 Transform sliders to get the desired result.
    In this next example I changed the top of the lighthouse from red to green (why I would want to do that, I don't know!).
    http://www.pixentral.com/show.php?picture=1XhqCAvgc0zVWReJDkUB2OLDQChSy
    Note that in this case I didn't have to move the fuzziness all the way right.

  • [svn:osmf:] 15505: Fix image smoothing, which had been broken as a result of some changes to how the display object of an ImageElement is exposed .

    Revision: 15505
    Revision: 15505
    Author:   [email protected]
    Date:     2010-04-16 09:29:26 -0700 (Fri, 16 Apr 2010)
    Log Message:
    Fix image smoothing, which had been broken as a result of some changes to how the display object of an ImageElement is exposed.  Add integration test.
    Modified Paths:
        osmf/trunk/framework/OSMF/org/osmf/elements/ImageElement.as
        osmf/trunk/framework/OSMFIntegrationTest/org/osmf/elements/TestImageElementIntegration.as

    That's a comment in the file. It has no effect at all.

Maybe you are looking for