Instant JavaFX saved in format JPEG always come out orange

I have an image editing program, and I want the user to be able to save in jpeg format. The code is very simple:
Image sealedPageImage = savingCanvas.getSnapshot();
File file = new File(sealFileName);
ImageIO.write(SwingFXUtils.fromFXImage(sealedPageImage, null), "jpg", file);
Just one problem: the image file comes out orange color each. Unique. Time. Research into it, I found that Java has the same effect with some BufferedImages created from some PNG files as well. For example, if you convert any PNG saved brush in a JPG file using ImageIO.write (), you will end up with an orange image. If I save in PNG, it looks good, but I absolutely need to be able to save in JPG format as well. I'm guessing this has to do with some kind of translation of the color space not executed, but damned, if I know how to solve this problem, after hours of searching for a solution. Someone has an idea?

Thank you
Ian

I had a similar problem not so long ago that was caused by transparency.

You must remove the alpha channel to write correctly a BufferedImage in JPEG with ImageIO.

BufferedImage bufImageARGB = SwingFXUtils.fromFXImage(sealedPageImage, null);
BufferedImage bufImageRGB = new BufferedImage(bufImageARGB.getWidth(), bufImageARGB.getHeight(), BufferedImage.OPAQUE);

Graphics2D graphics = bufImageRGB.createGraphics()
graphics.drawImage(bufImageARGB, 0, 0, null);

ImageIO.write(bufImageRGB, "jpg", file);

graphics.dispose();

Tags: Java

Similar Questions

  • My Dell is power saving mode and will not come out

    My Dell is power saving mode and will not come out? Any suggestions? I can't get anything else than a screen that says it is in power save mode and press a key or move the mouse. No one who does nothing. Don't disconnect.

    Hi Ma32206,

    Monitors Dell will automatically mode energy saving after a predetermined time amount when the computer is idle. The Dell monitor will go completely black, rather than display a screen saver. This allows your monitor to essentially turn off until it takes again.

    A. Press any key on the keyboard or move the mouse. Either will automatically turn off the power saving mode. Alternatively, you can press the power button on your Dell computer tower or laptop.

    B. press one button a second time if the monitor goes power saving in standby mode. Standby mode allows the screen saver appears.

    Bindu R - Microsoft technical support.
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • hp5100-pictures come out Orange

    Just started using my printer for photos. They come out in orange and yellow.

    I would say one of the three colors in your color cartridge is empty or blocked.  Buy and install a new ink cartridge.

  • My U3011 monitor goes in power saving on startup and not come out.

    My monitor has worked for years, and then just started going upward and don't start energy saving mode will come not awake. I replaced the DVI card and battery CMOS mother board, but no joy.

    What can I do to keep awake monitor?

    • PC and Windows version?
    • Do you not see anything on the screen (for example, Dell splash screen) before it goes into power saving mode?
    • Can you test this monitor on another PC or another monitor on this PC?
    • Have you swapped the video cable and checked the connections at both ends?
    • Make sure that the keyboard and USB mouse are connected directly to the back of the PC and not on the screen.
  • When I try to print anything from my pc it always comes out as a computer rather than what code ' on my screen

    I have windows xp and HP Photosmart C3180

    Tried using Notepad and webcapture with the same results also downloaded

    Hi percy.

    Normally when a printer prints gibberish, it means you have bad or bad drivers. What I would do is to uninstall the printer, then click on HP.com to get the printer drivers.  You'll want to get the right one is so make sure you look your version of windows, if its 32 or 64-bit and the printer model number which, in your case looks like C3180.

    When you have found the right drivers, save them to your C: drive, and then reinstall the printer pointing to these drivers.

    Hope this helps, but if you need assistance additional supplementaire reponse response with your version of windows, just type system (32 or 64) and I should be able to find the drivers for you.

    Good luck.

  • Design a business card - result comes out too small

    I have some experience with Flash Professional CS5 and use it to help design a business card.  So I'm not creating an application to create a business card.  I'm creating a static design I'll probably export as image and take to a printer.  I feel more comfortable in using Flash to do this at this stage.  The design looks good in Flash CS5, but when I export, it is too small.  I measured a physical 87 mm x 49 mm adapter, so I made the step of this size, using millimeters.

    I exported as a PNG, print design and it comes out like 66 mm x 37 mm - the correct proportions but it is about 75% of the size I want!  I tried editing design and open the HTML in a browser, but it always comes out looking for little ones.

    What I am doing wrong?  I guess I could anticipate the narrowing and define my step to 116 mm x 65 mm which seems silly.  Why should I do this?

    If you take your work to a printer, first call and get the specifications of what kind of files they will accept. My guess is that the .psd files would be one of them. You can also get the specifications for resolution, sometimes called points per inch (DPI) that really matches pixels by when we're talking resolution 'screen '.

    The reason why I propose 300 dpi for printing is because it's more or less the lowest resoultion standard used for printing... and it could even go higher.

    It's so any image, jpg, png, tiff, gif 1050 wide x 600 pixels high, when printing at 300 ppi will be exactly 3.5 in. by 2 in. (card format). The only time where it would be larger print is if you use a lower print resolution... say 150dpi... then it would print 7 x 4 in.

    BUT then the printer would be taken exactly same amount of ink and spreading it over a much larger area, with the result a much lower quality photo. By placing points of ink closer together (300 points per inch rather than only 150 points of ink) the quality is much higher.

    But your best bet is to speak directly to the printer, they will have the exact specifications, they are looking for.

    Good luck!

    Adninjastrator

  • HP Photosmart Plus B210a won't come out of power save mode.

    The printer works fine until it sits awhile and goes into 'power saving mode'. Nothing it comes out that mode except unplug the power cord and back running the printer. I disabled the: power saving mode and have had no problems. Is there a fix so I can turn the: energy safe mode: back on?

    I have a HP Photosmart Plus B210a and it's brand new. I am using Windows 7 32 bit and I get no error message. When I ran the HP print utility, all checked in green except when I tried to print a test page and test page remained in Quebec and a red X.

    Technical support told me that the problem was a hardware problem. They sent me a new printer!

  • A problem of time unusual Windows: time of Windows always comes back to the year 2005

    Specifications:

    Microsoft Windows XP Professional
    Version 2002
    Service Pack 3

    AMD Athlon XP 2700 +.

    At the start, and sometimes even if the computer is running, the windows of time always comes back to the year 2005, while maintaining the right hour, minute, second, day and month.

    I tried a number of solutions such as the "authoritative time server configuration", analysis of the computer for viruses and restarting the service of time via the command prompt, but without success. I am able to synchronize the time with a server, but only after the change of the year 2011.

    My installation of Windows is updated regularly and I'm always connected to the internet. I'm pretty sure that this is not a BIOS problem I replaced the CMOS battery and have ensured that the BIOS time is correct.

    In addition to the usual questions that arise in some programs due to an incorrect time, I noticed that when you use Firefox 4, the Google search engine always resets to "Instant Search" despite my having the clocks to the correct year.

    Any ideas?

    If I read your messages, I have that, amongst other times, pick up this always happens at startup.  This is the case, you can first check that the time is set correctly in the BIOS before you boot into Windows.  If it is, and, as you think, a program is causing this problem so the task is to know which.  A lot of startup programs each time you start Windows.  The boot configuration with minimum nude of running processes is called "Safe Mode".  So start your computer Safe Mode (press F8 as your computer starts).  When he arrives, check the date and time.  If it of OK and has not changed, then one of the other optional components must be the cause.  To narrow down that one, you can use "msconfig" to toggle the startup items groups until you find the one that is causing your problem.  The procedure for doing this is described in this article:

    "How to solve configuration errors by using the System Configuration utility in Windows XP"
      <>http://support.Microsoft.com/kb/310560 >

    I start by disabling everything in the "Startup" tab  If this solves the problem, then I start allowing things in this tab a little at a time until I have find the culprit. If the Startup tab does not resolve the problem, then I try disabling items in the tab "Services".  I usually start with non-Microsoft services.

    Of course on the machine who recently had this problem, you could try a shotgun approach and do a simple "System Restore" to a point in time before this problem.  It will probably fix the problem, but you will not know what caused it.

    "How to restore Windows XP to a previous state"
      <>http://support.Microsoft.com/kb/306084 >

    HTH,
    JW

  • Difficulties to display recorded XP of Windows Movie Maker movie file. You try to view saved WMV format results in arrested image creation, but the music continues.

    Problem with Windows XP Movie Maker. You try to view saved WMV format results in arrested image creation, but the music continues. Tried to re-record and solve the problem, no luck. Can properly view in Movie Maker as a project, but not the final version in WMV format.

    More details: I saved my Windows XP Movie Maker project in WMV format. I taped 3 ways: at my computer on a flash drive and a CD - r. Everything seemed fine until I try to see the movie. The video freezes on a different image in each of the places I recorded it, but the music continues & it's in the same place every time depending on what I am posting with (the computer it freezes on a certain task, the flash on another, the cd on another), tried re-register but it always does the same thing... gel on a photo but the music continues. Help! I can't find a solution anywhere. PS Please answer me "simply", as I'm not too computer savvy.

    Problem with Windows XP Movie Maker. You try to view saved WMV format results in arrested image creation, but the music continues. Tried to re-record and solve the problem, no luck. Can properly view in Movie Maker as a project, but not the final version in WMV format.

    More details: I saved my Windows XP Movie Maker project in WMV format. I taped 3 ways: at my computer on a flash drive and a CD - r. Everything seemed fine until I try to see the movie. The video freezes on a different image in each of the places I recorded it, but the music continues & it's in the same place every time depending on what I am posting with (the computer it freezes on a certain task, the flash on another, the cd on another), tried re-register but it always does the same thing... gel on a photo but the music continues. Help! I can't find a solution anywhere. PS Please answer me "simply", as I'm not too computer savvy.

    ===================================
    Some experiments to try.

    (1) create a small project with just a few pictures and see if it will play.

    (2) use .bmp photos to create the project instead of .jpg photos.

    (3) remove all transitions and resave the project as .wmv and see it it helps.

    (4) If your music .mp3 file... try to use .wma or .wav. John Inzer - MS - MVP - digital media experience

  • Hi, I want to get rid of "in search of Babylon" of firefox, I did everything but its always come when I press + for a new page. Please help me...

    Hi, I want to get rid of "in search of Babylon" of firefox, I did everything but its always come when I press + for a new page. Please help me...

    You are welcome.

  • I can't open firefox. Home page comes up, I get just the reporter Crash asking to restart/quit but every time I do the same message always comes back.

    I can't open Firefox. Home page comes up, I get just the reporter Crash asking me to restart/quit but every time I do the same message always comes back. I was not able to use Firefox for days now.

    In recent days, we have a lot of crashes with Trusteer report. If you have this program, try to disable it and see if that stops the noise.

    You can stop the report by using the Start Menu > programs > Trusteer report > report stop

    You can ask their helpdesk when a version update of their products will be available or, if you do not need this software, uninstall.

    http://www.Trusteer.com/support/en/report-problem

    If you do not report, so we have a crash report ID. When you send a report of the Mozilla crash puts it right in a gigantic database. We have no way to seek without the ID of the report. I don't know what the problem is without searching the crash report. Please get the ID of your last report of the accident report.

    See https://support.mozilla.com/en-US/kb/Firefox%20crashes

    or http://kb.mozillazine.org/Firefox_crashes

  • My phone has a gray spot and he goes but he always comes back and my phone is bulging commandeLorsque I try to push to vertical lines appear so I can't push

    My phone has a gray spot and he goes but he always comes back and my phone is bulging commandeLorsque I try to push to vertical lines appear so I can't push

    Is that an iPhone 5? If so, you may have a battery of swelling which pushes the screen and that may have caused damage to the screen.

  • Vista Clock on bar always come back 1 hour of tasks

    Vista Clock on bar always come back 1 hour despite the reset of the tab "internet time" I tried different providers in the list but no help tasks.

    So boring. Any help please?

    I think I have it: Harae-Pretoria.

    We are an hour before. I don't know why + 2 hrs Pretoria works. The computer cannot know what area I'm in and of itself. No other choice?
    Thank you.
  • Don't boot to desktop-Boot computer ups always come with "no input signal" for monitor

    Thanks for the research on this issue.  So first of all, he could start after a few attempts in the end goes to the blue screen error at approx. 5 min. I started this path several times that in "safe mode with network" to try the many suggestions of repair for two days. " At this point, it's freezing just at "windows is loading files", but probably will go to blue screen error. Boot ups always come with "no input signal" for the monitor and signal switching in the Help menu for 5 min periods I've mentioned and then fails or "monitor going to sleep" occurs.

    The error messages rec'vd: corrupted image, corrupted file and header file check sum does not match the sum of computer control. The recommendations of the screen blue: disable the BIOS memory, any material current or drivers and check disk space.

    Some tent to fix: memory diagnostics and it showed 'no problem', checked monitor on another computer and it works, in a session of 5 min a download to 'fix' Microsoft via a USB problem like "search of windows crashes" but was 'unable to set', a few other attempts would show the "windows installer has stopped working" preventing any action.

    At the present time, am unable to start even with advanced at F8 options.  It's HP Pavilion 10/2007, with the help of HP. Its on a wireless network with a netbook, Blu - ray, occasionally a cell phone that works on windows live but none presents as a device.

    Hello

    ·        You did changes to the computer before the show?

    ·        What is the exact error message that you receive?

    Method 1: Remove the external devices except the keyboard and mouse and try to restart the computer in safe mode and check if you can start inside.

    If you are able to boot into safe mode then try a restore of the system it and check if it helps solve the problem:

    http://Windows.Microsoft.com/en-us/Windows-Vista/system-restore-frequently-asked-questions

    Method 2: I suggest you do a system recovery options system restore and see if it helps:

    http://Windows.Microsoft.com/en-us/Windows-Vista/what-are-the-system-recovery-options-in-Windows-Vista

    Method 3: If the system restore does not help then do a startup repair and check if this solves the problem.

    http://Windows.Microsoft.com/en-us/Windows-Vista/startup-repair-frequently-asked-questions

  • Size reduction after export of the LR5 in image format JPEG /Formaat reductie

    After exporting my pictutes of LR 5 in format JPEG (pictures) size reduced sharply to the acceptable format of the United Nations. IE: photo 4256 x 2832, after export size is reduced to 1000 x 665 or 522 kB. This picture is not good enough to make photo albums.

    For a few months, I have had no problem at all with the sizes. 3500 x 1943 JPEG and size 2.05 MB all natural weres. What can be the reason for this negative problem?

    Nog even in het Nederlands: naar Mijn tuning of Na het i.e. van bewerkte foto ITU LR5 in JPEG is sinds kort het formaat teruggebracht naar een niet acceptabel level. Example: 4256 x 2832 wordt naar solution 1000 x 665 522 kb. Grote met fotoboek foto voor een says geen werkbaar formaat, especially omdat het eigenlijk op andere dag optrad ene van verkleiningsprobleem. Voor die tijd has een formaat van 3500 x JPEG 2.05 MB gebruikelijk 1943. IK kan niet wat ik verkeerd doe ik verkeerd gaat wat en gud. MOET er soms een page worden veranderd?

    In the export dialog box, make sure that:

    The quality is 80 or more

    Do not file size limit

    Not resize to the Fit

    I will appear one or all these are a limitation in your export to JPEG.

Maybe you are looking for