Incorrect colors when drawing an image

Hello!
I use Java 5 update 4 and Windows XP in 16-bit color depth mode. I run the following code:
BufferedImage in=ImageIO.read(<A_JPG_FILE>);
BufferedImage im=GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(in.getWidth(),in.getHeight());
Graphics g=im.createGraphics();
g.drawImage(in,0,0,null);
g.dispose();If I paint the image in a Graphics context that has the INTERPOLATION_BILINEAR rendering hint set, the colors change and the resulting image displayed is incorrect. E.g. blue becomes magenta.
This happens only to "compatible" images.
Does anybody know why this color shifting happens? Is there any workaround?
Thank you,
George Vasiliou

Tho this my not be the solution, have you tried using a Graphics2D object instead of a Graphics object (using the method drawImage(BufferedImage, BufferedImageOp, int, int) )? I suggest you try it out, you never know (I don't know if this will actually make a difference, but it can't kill to try).
JMaster

Similar Messages

  • Changing the background color when opening an image?

    I just installed Firefox on my new Windows laptop, and when I open an image in a new tab the background around the image is a dark gray. On my old computer the background is white, which I much prefer. How do I change this setting?

    It is a new feature in Firefox 11+ versions to display a single image centered with an almost black background.
    It is added by this stylesheet:
    * resource://gre/res/TopLevelImageDocument.css
    You can look at this extension to set your preferred background color and remove the centering.
    * Old Default Image Style: https://addons.mozilla.org/firefox/addon/old-default-image-style/
    See also these forum threads for other solutions (e.g. userContent.css):
    *[[/questions/923127]]
    *[[/questions/923431]]

  • Incorrect color when printing photos--HP Photosmart C5280

    Good afternoon.  The color is WAY off when printing photos.  Am using an HP Photosmart C5280 All-in-One.  Colors appear somewhat muted, as well as having too much red and yellow.  Have tried adjusting color, but then photo definition is lost.  Do photo pixels have anything to do with color quality?

    I have exactly the same problem with my hp photosmart c5380. Have you had any sucess with yours as i have tried every thing I can think of without any sucess

  • I am trying to connect a Macbook Pro to a projector for a Powerpoint presentation. When I use a VGA cable, the color of the projected images are not good. When I use a USB cable, the projected image includes the presenter notes on my computer screen?

    I am trying to connect a Macbook Pro to a projector for a Powerpoint presentation. When I use a VGA cable, the color of the projected images are not good. When I use a USB cable, the projected image includes the presenter notes on my computer screen?

    To move an iPhoto Library to a new machine:
    Link the two Macs together: there are several ways to do this: Wireless Network,Firewire Target Disk Mode, Ethernet, or even just copy the Library to an external HD and then on to the new machine...
    But however you do choose to link the two machines...
    Simply copy the iPhoto Library from the Pictures Folder on the old Machine to the Pictures Folder on the new Machine.
    Then hold down the option (or alt) key key and launch iPhoto. From the resulting menu select 'Choose Library'
    and select the Library that you moved.  That's it.
    This moves photos, events, albums, books, keywords, slideshows and everything else.
    Your first option didn't work because you imported one Library to another. Every version and thumbnail is imported like a distinct photo, you lose all your Albums, Keywords etc., the link between Original and Previews is destroyed, the non-destructive editing feature is ruined and so on. In summary: it's mess.
    Your second option didn't work because you simply referenced her library on the old machine.
    Regards
    TD

  • When inserting a .pdf of a document with a standard white paper color the test and images show up, but the white background is transparent. How do you also make the white paper color show up?

    When inserting a .pdf of a document into a Keynote template with a standard white paper color the text and images show up, but the white background is transparent. How do you also make the white paper color show up?

    Use the color fill option - select the inserted .pdf and assign a fill color of white to it using the Color Fill Menu on the Toolbar or the Color Picker Palette.
    Good Luck.

  • When printing to the dye sublimation epson stylus pro 7700 using adobe illustrator it is required that I mirror the image.  When mirroring the image the print colors are muted.  Not mirrored and the print colors are perfect.  Any suggestions?

    When printing to the dye sublimation epson stylus pro 7700 using adobe illustrator it is required that I mirror the image.  When mirroring the image the print colors are muted.  Not mirrored and the print colors are perfect.  Any suggestions?

    CS5
    On Tue, Oct 7, 2014 at 9:49 AM, ADBEDesigner <[email protected]>

  • Incorrect colors after importing a RAW image into LR

    I shoot in RAW mode using Canon EOS 400D.
    After importing RAW images into LR, EVERY image I shot gets oversaturated with green-yellow colors. If I open same image in C1 Pro colors look fine.
    If I change shooting mode on my camera to JPG (using sRGB color space) and import image into LR, colors look same as on RAW image in C1 Pro. All settings in LR and C1 Pro are set to default.
    My guess is that LR applies wrong (camera?) profile when it imports a RAW image. I don't think it's a difference in RAW converters, because the difference in colors is really huge.
    In the Camera Calibration panel I see ACR 3.6 profile selected and all settings are set to 0. Using sliders I can correct colors on image, but I failed to make a generic preset that could be applied on all imported RAW images.
    My monitor (Samsung 940BF) is setup to use manufacturer ICC profile. I tried to change it to sRGB or Adobe RGB, it doesn't help. I'm running Windows XP SP2.
    Any thoughts on how to return colors back to normal?
    Here are 2 examples of the same image converted by:
    1. LR
    [url=http://img263.imageshack.us/my.php?image=img1258lightroomsmallcp7.jpg][img]http://img 263.imageshack.us/img263/8411/img1258lightroomsmallcp7.th.jpg[/img][/url]
    2. C1 Pro
    [url=http://img156.imageshack.us/my.php?image=img1258captureonesmallcz2.jpg][img]http://im g156.imageshack.us/img156/9339/img1258captureonesmallcz2.th.jpg[/img][/url]

    Morey,
    there is no such options as "import settings into LR" you have to put the ACR-settings-file into the "~/Library/Adobe Lightroom/Develop Presets" folder (on a Mac). I think in the end its faster to just copy the numbers manually from ACR and save the preset from within LR.
    No, I don't think that calibrating has anything to do with profiles, at least not from what I understand as a profile (like sRGB or ProPhoto profile). It is kind of changing the stored default calibration values for a given camera type (something which one of course could also call a profile). It is definitive not like doing any double profiling or so.
    @Lee Jay,
    on different forums you can find values for ACR camera calibration of different cameras, googling should reveal some. Problem is that the numbers for the calibration change with the lens and, more important, there seems to be a lot of leeway regarding the behaviour of individual cameras of the same model. I found a lot of numbers on the net which didn't work with my D70, in the end I had to calibrate it myself. But your experience might differ, so I would suggest that you just have a look at what google offers.
    One last thing: You don't need to buy a PS version which is compatible with ACR 3.7 or 4.0. You can use the 30 day trial version of PS for this. Afterall you most probably only need to calibrate each camera once and I doubt that Adobe disapproves this use of a trial version as long as it helps to sell LR. ;-)
    Bye,
    Carsten

  • When i place my photo, the adjustments tab does not pop up, and even when i click image at the top, I cannot select any adjustments-brightness/contrast,hue-saturation, color blance, etc..Anyone know what I am doing wrong?

    When i place my photo, the adjustments tab does not pop up, and even when i click image at the top, I cannot select any adjustments-brightness/contrast,hue-saturation, color blance, etc..Anyone know what I am doing wrong?

    Good day!
    What is "place" supposed to mean – open, place as Smart Object, …?
    What are the image’s Color Mode and bit depth?
    Could you please post a screenshot with the pertinent Panels visible?
    Does Window > Adjustments not raise the Adjustments Panel?
    Regards,
    Pfaffenbichler

  • Report Viewer renders incorrectly when set to "IMAGE"

    I read this;
    http://social.msdn.microsoft.com/Forums/en-US/b4a6eb43-0013-435f-9d11-00ee26a8d017/report-viewer-error-on-export-pdf-or-excel-from-azure-web-sites?forum=windowsazurewebsitespreview
    And after upgrading to "Basic" mode on Azure websites I was able to render PDF, EXCEL and WORD formats.  However when set to IMAGE the rendered binary is entirely black.  No errors are thrown.  The binary contains data (33kB).  I
    have tried changing the deviceInfo settings to include <OutputFormat>JPEG</OutputFormat> and a few other variants.
    I have super verified that when run on my local machine the render works correctly but not on Azure websites.
    I imagine that the class of bug we are dealing with here is a permutation of the API was accidentally not enabled/tested when making the fix for the GDI issue mentioned in the link above.
    This capability is very useful for enabling MVC Restful API's solutions.  I think the business value is very high.  Please help, I figure it will be a quick fix?!

    Thanks for the report.  Can you supply me a sample piece of code that demonstrates the problem, or point me to your web site -> the best way is communicate that is using our new support site. 
    http://azure.microsoft.com/blog/2014/10/08/support-site-extension-for-azure-websites-preview-release/
    Please include enough information so I can repro the scenario myself and see what failed. 

  • Layer Group Channel blending, incorrect colors

    Hello!
    Wanted to bring up an issue that has troubled me in Photoshop for years, with the hope of it gaining some traction for fixing. For a while now (unsure which version), it was possible to set a Layer Group to filter/isolate a specific channel. This is a very useful feature for me, in creating channel masks for game assets and for use in real time shader techniques. However, it has a very large flaw that has made the feature largely unusable - and I'm surprised others have not had the issue as well as it should affect print as well (if in a lesser effect).
    When you use this feature, and essentially mask the contents of a layer to the Red, Green, or Blue channels, the layers in those Groups are still hit by color management, which results in the pixels drawing and blending incorrect colors. an example:
    In the first file, each group is set to blend to a specific channel, and a black to white gradient is applied in that layer.
    In the second file, those same layers are copied and pasted into the channels of a new RGB document. The file already looks very different.
    Finally, in the 3rd file the two layers are compared using the Difference blend mode. Can observe the difference between the two layers here, which is a result of the first method (Layer Grouping) not blending the pixels properly as if they were a channel - which when using the R/G/B blend masking on Group Properties, is what should be expected.
    When i use this technique of pushing certain black and white images into a channel, they are made for a specific purpose and function. Since the layer group blending alters what the values of those pixels are (very important for real time shader creation) in the final file, it makes this amazingly useful feature unusable. I would LOVE to be able to have Layer Group channel blending be a part of my workflow, instead of constantly copying and pasting into channels. I have created various scripts to save these types of files out easier, but i could greatly simplify them by being able to save this 'RGB Mask' file directly from my PSD.
    Wanted to share and start a discussion about it, to see if it would be possible to get a fix for this in the future!
    thanks!
    Maury

    don't generally like to bump threads, but bumping for some visibility and maybe some insight?

  • Indesign issues. Impossible to fill a form created by the pen either with color either with an image. The image is there but is invisible. Same problem with the line (impossible to color it or to change the tickness. Is there anything to change in the pre

    I have recently installed Indesign CC (I had the CS 5.5). I have some issues in doing simple things such as fill in a forma created with the pen either with a color either with an image. The image is there but is invisible. same issue when I want to draw a line. Impossible to color the line  and when I increased the thickness, it was creating a sort of wrap around the shape. have you ever encountered this kind of issue ? Thanking the community for his help.

    You will probably get better help in InDesign
    This forum is about the Cloud as a delivery process, not about using individual programs
    If you start at the Forums Index https://forums.adobe.com/welcome
    You will be able to select a forum for the specific Adobe product(s) you use
    Click the "down arrow" symbol on the right (where it says All communities) to open the drop down list and scroll

  • How to Change the color of the black image

    Hi,
    I have created a black image. But want to insert some text and chnage the color of the same. I am trying to do it, by usign various classes of javax.imageio.*, java.awt.image. But, I have not the required output till now. I am showing my code below. The image I created is totally black.
    Any suggestion greatly appreciated.
    File f = new File("C:/tomcat5.5.15/apache-tomcat-5.5.16/webapps/plugintest/03974701.jpg");
    BufferedImage image = ImageIO.read(f);
    int height = image.getHeight();
    int width = image.getWidth();
    int type = image.getType();
    ColorModel cm = image.getColorModel();
    System.out.println("Width of the Image is "+width);
    System.out.println("Height of the Image is "+height);
    System.out.println("type of the Image is "+type);
    BufferedImage image1 = new BufferedImage(width,height,type);
    //image1.setRGB(45,45,rgb);
    File f1 = new File("blank.jpg");
    RenderedImage ri = image1;
    ImageIO.write(ri,"jpg",f1);

    Color c = new Color(0, 0, 0);
    Graphics g = image1.getGraphics();
    g.setColor(c);Thanks for your suggestion I added these lines to the
    code(code is shown above), but the there is no change
    in the color of the jpg image saved in the file. Am I
    missing something.Yes.
    a) Do you know what color 0,0,0 is? Hint: not mauve
    b) When you call set color that sets the drawing colour. But you aren't drawing anything. You can draw things with the methods of Graphics and Graphics2D. I suggest starting with fillRect
    http://java.sun.com/developer/Books/Graphics/
    Thanks

  • Using Illustrator CS6, how to preserve drawn colors when Save For Web to PNG?

    Using Illustrator CS6 on Mac OSX 10.9.1:
    step 1. I open a new file for Web profile.
    step 2. I verify that File > Document Color Mode is RGB.
    step 3. I draw a square and set it's color to 0,103,197 (decimal).
    step 4. I click File > Save For Web
    step 5. In the popup that opens, I set to PNG-24, and verify the option Convert To sRGB is not selected.
    step 6. Using the Mac's DigitalColorMeter, I observe the color is 0,109,191 in the Save For Web popup. If I save it, then open the saved PNG file, it's color is also 0,109,191.
    How to do this so the colors don't change?
    step 7. I close Save For Web popup.
    step 8. I verify Edit > Color Settings for Working Spaces is set to Monitor RGB, and that the Color Management Policies for RGB is off.
    step 9. I verify Edit > Assign Profile is set to Don't Color Manage This Document.
    step 10. I verify View > Proof Colors is off.
    Can anyone provide a set of Illustrator CS6 settings that let me save a PNG image with the same colors it's drawn in so I can use that PNG image in a website?
    I must be missing something obvious, because anyone working in web design must do this day in and day out, please let me know what procedure people follow to achieve this.
    UPDATE:
    Using the above procedure DOES preserve the colors when embedding the PNG image in a webpage viewed in Firefox and Chome, but NOT for Safari. Also, the colors are not preserved in Mac's Preview software, as well as Microsoft Office 2011 for Mac.
    I'm pretty new to all this. Hoping someone can provide some perspective on what typical procedure people use for web development when working with colors in Illustrator CS6.

    Using Illustrator CS6 on Mac OSX 10.9.1:
    step 1. I open a new file for Web profile.
    step 2. I verify that File > Document Color Mode is RGB.
    step 3. I draw a square and set it's color to 0,103,197 (decimal).
    step 4. I click File > Save For Web
    step 5. In the popup that opens, I set to PNG-24, and verify the option Convert To sRGB is not selected.
    step 6. Using the Mac's DigitalColorMeter, I observe the color is 0,109,191 in the Save For Web popup. If I save it, then open the saved PNG file, it's color is also 0,109,191.
    How to do this so the colors don't change?
    step 7. I close Save For Web popup.
    step 8. I verify Edit > Color Settings for Working Spaces is set to Monitor RGB, and that the Color Management Policies for RGB is off.
    step 9. I verify Edit > Assign Profile is set to Don't Color Manage This Document.
    step 10. I verify View > Proof Colors is off.
    Can anyone provide a set of Illustrator CS6 settings that let me save a PNG image with the same colors it's drawn in so I can use that PNG image in a website?
    I must be missing something obvious, because anyone working in web design must do this day in and day out, please let me know what procedure people follow to achieve this.
    UPDATE:
    Using the above procedure DOES preserve the colors when embedding the PNG image in a webpage viewed in Firefox and Chome, but NOT for Safari. Also, the colors are not preserved in Mac's Preview software, as well as Microsoft Office 2011 for Mac.
    I'm pretty new to all this. Hoping someone can provide some perspective on what typical procedure people use for web development when working with colors in Illustrator CS6.

  • PS file in illustrator changes color when I move it??

    When I open a ps file in illustrator some objects change color when I move them and are displayed correctly in preview and Photoshop, why and how do I fix this?
    Also the object seems to be duplicated. It should have the same and only the colors of the scale bar. In another file the image part is correct and the scale bar is incorrect.
    Should look like this:

    It is an odd problem. The "good" screen shot is from opening the PS file in mac's preview. As it is, I use several tools in illustrator to get the final image where I need it to be; several layers and what not. I have tired 5, 5.1, and 6 with the same problem. Again I have a different problem when I use a different figure:
    As you can see just the opposite problem is the case. The map part is good while the color scale if off. Both parts are made in the same way and more or less in the same sequence, I don't think it is purely a problem at birth and other software can "see" it correctly, so I don't think it is a hardware problem.  

  • Colorizing a constantly changing image - how to release this properly?

    Hello- I have done some searching on google and various forums but can't find a good answer for this. Hoping someone here can help. I'm assuming there has got to be a simple solution that I'm overlooking, but I've spent countless hours messing around with this and always get back to the same results....
    I am using a custom UIView to take a snapshot of the current view and tint it with a color.
    The tricky part is that the image changes every half second, whereas most people trying to do this out there are using static images from what I've seen.
    The code performs the task correctly except that it continually allocates until memory runs out.
    I have tried creating the custom UIView programmatically then as a property that I released, then I tried using IB ( and various combinations) in an attempt to stop the allocating... can't seem to stop it. Currently defined in IB and declared as a property.. released in -dealloc....
    I have also tried using a separate image property and drawing or setting background to that in the custom view but to no avail.
    If I comment out the line where I change the background image, no memory problems.....
    Here's what I'm currently doing in the superview... the blendView object is sized and laid out in IB:
    (code has been simplified for example purposes, and I've left in some commented out code showing other things I've tried)
    TintView.h:
    #import <UIKit/UIKit.h>
    @class BlendView;
    @interface TintView : UIView {
    IBOutlet BlendView *blendView;
    @property (nonatomic,retain) IBOutlet BlendView *blendView;
    TintView.m
    #import <QuartzCore/QuartzCore.h>
    @implementation TintView
    @synthesize blendView;
    - (void) blendTheView { // gets called every half second as the image gets updated
    blendView.hidden = YES; //hide blendView so we can make a new one
    blendView.theColor = [UIColor colorRed];
    UIGraphicsBeginImageContext(self.bounds.size);
    [self.layer renderInContext:UIGraphicsGetCurrentContext()];
    blendView.backgroundColor = [UIColor colorWithPatternImage:UIGraphicsGetImageFromCurrentImageContext()];
    UIGraphicsEndImageContext();
    blendView.hidden = NO;
    - (void)dealloc {
    [blendView release];
    [super dealloc];
    And here's the definition of the class:
    BlendView.h:
    #import <UIKit/UIKit.h>
    @interface BlendView : UIView {
    UIColor *theColor;
    @property (nonatomic, readwrite, retain) UIColor *theColor;
    @end
    BlendView.m:
    #import "BlendView.h"
    #import "TintView.h"
    @implementation BlendView
    @synthesize theColor;
    - (id)initWithFrame:(CGRect)frame {
    if ((self = [super initWithFrame:frame])) {
    // Initialization code
    theColor = [UIColor redColor];
    return self;
    - (void)drawRect:(CGRect)rect {
    //self.backgroundColor = [UIColor colorWithPatternImage:theImage]; // works, but allocs infinitely. just like when assigned from super view
    //[theImage drawInRect:rect]; // makes a distorted image (too short and too wide) - also doesn't update the image each time
    //CG Method:: :::: (works, but more code than the UI method)
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSaveGState(context);
    CGContextSetBlendMode (context, kCGBlendModeMultiply);
    CGContextSetFillColor(context, CGColorGetComponents(theColor.CGColor));
    CGContextFillRect (context, rect);
    CGContextRestoreGState(context);
    // UI Method:: ::: (seems to work just as good as the CG method above)
    [theColor set];
    UIRectFillUsingBlendMode(self.bounds, kCGBlendModeMultiply);
    - (void)dealloc {
    [super dealloc];
    @end

    Well, after countless hours of experimenting with allocs and releases I have determined that there must be a hidden alloc that you just can't do anything about whenever you set a UIView's background color to a pattern image.. even if you release the UIView..... oh well....
    Funny thing is, upon re-visiting some earlier code you'll see commented out, I got it to work with no problems.
    If anyone is curious, I went back to declaring a UIImage property, "theImage" in my BlendView class
    I pass the snapshot to the image property and in the -drawRect method I went back to using the line:
    [theImage drawInRect:rect];
    I don't know why it was distorting and remaining static for updates when I first tried this line out, but it is now working perfectly with no extra allocs

Maybe you are looking for