Canvas and BufferedImage display drawString differently.

I use the same method to paint the Canvas and the BufferedImage. But the Graphics2D drawString method
shows up correctly on the Canvas but not on the BufferedImage (JPEG). Why is there a difference?
I use the Graphics2D to rotate the text 90 degrees.
I can't think of any reason why the display comes out different.
Any suggestions???
Thanks.

Here is the code for putting the Canvas graphics onto the BufferedImage (JPEG).
public void save(HCanvas comp) {
int w = comp.getWidth();
int h = comp.getHeight();
Frame frame = new Frame();
BufferedImage im = new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = im.createGraphics();
g2.setPaint(Color.white);
g2.fillRect(0,0,w,h);
g2.setPaint(Color.black); // back to default color
comp.paint(g2); // Graphics argument
g2.dispose();
FileDialog fd = new FileDialog(frame,"Save As JPEG",FileDialog.SAVE);
fd.show();
try {
String dum;
dum = fd.getDirectory() + fd.getFile();
OutputStream out = new FileOutputStream(dum);
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
encoder.encode(im);
out.flush();
out.close();
im.flush();
} catch (Exception FileNotFoundException) {
String errormsg = "File Not Assigned";
JOptionPane.showMessageDialog(frame, errormsg);

Similar Messages

  • Canvas and BufferedImage display different.

    I use the same method to paint the Canvas and the BufferedImage. But the Graphics2D drawString method
    shows up correctly on the Canvas but not on the BufferedImage (JPEG). Why is there a difference?
    I use the Graphics2D to rotate the text 90 degrees.
    I can't think of any reason why the display comes out different.
    Any suggestions???
    Thanks.

    Here is the code for putting the Canvas graphics onto the BufferedImage (JPEG).
    public void save(HCanvas comp) {
         int w = comp.getWidth();
         int h = comp.getHeight();
         Frame frame = new Frame();
         BufferedImage im = new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
         Graphics2D g2 = im.createGraphics();
         g2.setPaint(Color.white);
         g2.fillRect(0,0,w,h);
         g2.setPaint(Color.black);          // back to default color
         comp.paint(g2);                              // Graphics argument
         g2.dispose();
         FileDialog fd = new FileDialog(frame,"Save As JPEG",FileDialog.SAVE);
         fd.show();
         try {
              String dum;
              dum = fd.getDirectory() + fd.getFile();
              OutputStream out = new FileOutputStream(dum);
              JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
              encoder.encode(im);
              out.flush();
              out.close();
              im.flush();
         } catch (Exception FileNotFoundException) {
              String errormsg = "File Not Assigned";
              JOptionPane.showMessageDialog(frame, errormsg);

  • Two External Displays and Internal Display Over Different Connections

    Hi there.
    I'm going to be purchasing a rMBP in the very, very near future. However, I am unclear about how external displays work with this. My current display setup at work is two basic 1080p monitors that can be run over DVI, VGA or HDMI. I'd like to keep using these when I start using the rMBP but also gain the advantage of a third screen by using the internal display at the same time (so much space for activities!).
    One of the thunderbolt ports will need to be used for an Ethernet connection (there is no wireless here), so this leaves the setup needing to be one monitor run via Thunderbolt -> DVI and the other monitor run via HDMI.
    The internet in general isn't being entirely helpful with this. I'm looking for a clear answer of whether the rMBP will run the internal display and the two external displays using this setup under OS X. Some seem to believe that it won't work using different connection types, for example.
    Thanks for any help.

    Hello dljfield,
    Thanks for using Apple Support Communities.
    If you'd like to use multiple external displays with a MacBook Pro with Retina display, then please take a look at the information outlined below. A 15" MacBook Pro mid-2014 can support up to two external displays using different outputs.
    MacBook Pro (Retina, 15-inch, Mid 2014) - Technical Specifications
    OS X Yosemite: Connect multiple displays to your Mac
    Take care,
    Alex H.

  • Lightroom and photoshop display colours differently??

    I have just done a colour critical shoot of fashion garments. There is a dramatic difference particularly noticeable in Purple colours between Lightroom and Bridge. Lightroom displays it as blue and Bridge displays it correctly. I cannot figure out why this is - it means that I cannot work in Lightroom as I am not sure if the colour is correct or not.
    Please - if anyone can shed some light on this I will be eternally grateful.
    By the way I work on a mac with CS3 and the latest lightroom - on a calibrated system so it is not a calibration issue.
    Marc

    Are you sure that bridge is actually generating previews from the RAW and that you are not just looking at the camera-generated jpeg preview embedded in the RAW? This is pretty typical for bridge to do. The camera-generated preview generally looks very different color-wise from Lightroom and ACR because the camera manufacturer. Test this by double-clicking the RAW in bridge. Usually the color will be quite different from the preview you see in Bridge. After you close ACR, the preview will get updated in Bridge too. The reason behind this color difference is that camera manufacturers use secret, proprietary algorithms to determine the color from the camera's raw sensor data. This color is not necessarily correct, but what they consider "pleasing." If you shoot RAW, your RAW converter supplies its own interpretation of the data. Usually based on shooting color patches with the same camera.

  • Lllustrator and Photoshop display different colors despite synchronized CS5 Color Settings

    I've got some students who noticed that Illustrator and Photoshop display completely different colors on screen for eactly the same RGB values despite Color Settings being synchronized.
    Settings are:
    CSF: North American Web/Internet  (RGB color space = sRGB),
    Proof Set-up: Internet Standard sRGB
    Proof Colors turned On.
    RGB Values:  R=0  G= 162  B=211
    But colors displayed are not close between Ai and Ps.
    With Proof Colors turned off, both apps display the colors reasonably closely.
    I teach Photoshop and Print Color Management, so I admit my knowledge of how Illustrator handles screen proofing and proof set-ups for screen destinations is not comprehensive.
    I expect I'm missing some difference in the two apps' behaviour.
    Any info from anyone experienced in this corner of the field appreciated.
    Cheers
    Tom

    I've got some students who noticed that Illustrator and Photoshop display completely different colors on screen for eactly the same RGB values despite Color Settings being synchronized.
    Settings are:
    CSF: North American Web/Internet  (RGB color space = sRGB),
    Proof Set-up: Internet Standard sRGB
    Proof Colors turned On.
    RGB Values:  R=0  G= 162  B=211
    But colors displayed are not close between Ai and Ps.
    With Proof Colors turned off, both apps display the colors reasonably closely.
    I teach Photoshop and Print Color Management, so I admit my knowledge of how Illustrator handles screen proofing and proof set-ups for screen destinations is not comprehensive.
    I expect I'm missing some difference in the two apps' behaviour.
    Any info from anyone experienced in this corner of the field appreciated.
    Cheers
    Tom

  • Xperia Z1 Compact - JDI and AUO Display Panels used

    Xperia Z1 Compact using JDI and AUO display Panels differently confirmed - Display Lottery is spotted again :/
    Let’s have a look at Xperia Z1 Compact display panels.
    Xperia Z1 Compact using AUO Display panel
    Image Link - http://cdn1.xperiaguide.com/wp-content/uploads/2014/02/Xperia-Z1-Compact-using-AUO-Display-panel.jpg
    Xperia Z1 Compact using JDI Display panel
    Image Link - http://cdn.xperiaguide.com/wp-content/uploads/2014/02/Xperia-Z1-Compact-using-JDI-Display-panel.jpg
    How to Identify which panel your Xperia Z1 Compact using ?
    You may need root to find that out but if your Xperia Z1 Compact is not rooted then use a file manager like “Solid Explorer”. Open it and then navigate to #_ System Root > sys > devices > mdss_dsi_panel > panel_id and Check what is mentioned there.
    Sony has used different panels for Xperia Z1, Xperia Z1 F and now for Xperia Z1 Compact, well it seems display lottery will affect future flagship devices also.
    Source - http://www.xperiaguide.com/2014/02/19/xperia-z1-compact-using-jdi-auo-display-panels-differently/
    Don't forget to give Kudos.

    Castanje wrote:
    Isn't this illegal?
    What laws exactly do you think are being broken?
    Every phone manufacturer does this, even Apple. They use different factories and companies across a production run (e.g. JDI, Sharp and LG for iPhone 5) and the panels will have slightly different characteristics despite being of the same type. Apple chooses to callibrate each panel in the factory, however, which not many others do. Customers should demand this, though, and just return their phones if they're not happy with their panels.

  • Contrast / Gamma Different in Canvas and Desktop Preview

    *The Confusion:*
    The contrast of my video differs between the Canvas Window and Desktop Preview.
    I assume the two are using different gamma settings. But I can't figure out what's going on, to know what those settings are and how to assess the final display picture.
    *Screen Grabs:*
    Here's a screen grab of the canvas, with the image at 100%. The screen grab does not show the full frame.
    - - - http://epokhecutmedia.com/images/gamma-ts-canvas.png
    Here's a full screen grab of image in Desktop Preview.
    - - - http://epokhecutmedia.com/images/gamma-ts-preview.png
    *What I've done:*
    I've gone through every gamma setting I know of and can't match the Canvas and Desktop Preview or make sense of the difference.
    Also, If I toggle between Display calibrations of 1.8 and 2.2 using the Display preferences in System Preferences, values in both the Canvas and Desktop Preview shift and still do not match.
    *Another seemingly related thing:*
    My Canvas window display jumps between different contrasts (possibly gamma values) automatically while I'm working.
    For example,
    - - - I'll have video frozen. I'll play it and the image with brighten across the mids with playback. However, after freezing it again it keeps the brighter value.
    - - - When I'm using filter, such as the 3-Way Color Corrector, when I click to drag a slider, the image with darken across the mids. Sometimes, as I drag, the canvas will erratically jump back and forth between the two values.
    *Why this is a problem:*
    I can't do basic exposure correction, because I don't know which is the accurate value to work with.
    edit by: FordPrefectRevisited, Screen Grabs added

    If I may re-open this thread, let me ask the question FordPrefect only alluded to:
    Given that I should be using a pro-level HD broadcast monitor to view everything, given that every piece of footage is different in the particulars, and given that the Canvas Window image is almost always different than any other playback system (Finder, QT, VLC Players, etc.), are there general exposure/gamma changes y'all make to account for the visual difference between the Canvas Window and other playback systems? If you're anything like me, you don't start from SCRATCH on every single edit... You have a few go-to filters with a few go-to settings, and then make minor adjustments according to the needs of the footage.
    For instance, in order to get the exported image close in exposure to the ideal Canvas Window image, I usually go: Effects - Video Filters - Quicktime - Brightness and Contrast - and then adjust the Brightness to 0.85 and it seems to get close.
    You guys have anything like that? Thanks for any help!

  • How do I make a 20 X 30 print with layers of 16 X 20, 12 X 18, 11 X 14, 8 X 12, 8 X 10, 5 X 7 and 4 X 6 of the same image to display the different sizes available to someone?  Using Elements 13 with Windows 8.1

    How do I make a 20 X 30 print with layers of 16 X 20, 12 X 18, 11 X 14, 8 X 12, 8 X 10, 5 X 7 and 4 X 6 of the same image to display the different sizes available to someone?  Using Elements 13 with Windows 8.1
    A senior citizen needs some help.
    Thanks

    Saving each image as different size - is it an option for you?  I would save images with their name as: 20x30.png, 16x20.png etc etc.
    Or explain whether you want these in a webpage  in which case only one image is necessary and different sizes are displayed with good CSS code.  this is question for Dreamweaver forum if this is what you want.

  • Canvas and viewer won't display video correctly

    I have just reinstalled and then reinstalled 5.1.4. Picture plays on external video monitor but will not play in either canvas or viewer. RGB is set. Mirror on playback is set. Audio will play. Viewer will play on external monitor. Usually a still will be on viewer of canvas screen or just a jumbled mess. Sometimes with parts of display frame included in mess. Thanks for any help.

    Thanks for posting helpful info re my problem. Issue finally resolved. FYI in case you should encounter a similar problem. I failed to mention in my post I was running two video displays. The video card I was running on when I developed the problem had been my auxilary display and was too underpowered to run the canvas and viewer. I inadvertaintly switched final cut pro to that card and monitor when my previous main monitor quit. I simultaneously had a drive boot problem. All is well that ends well, I suppose. Only took 4 days to sort it out and could find no info in tech manual that would have led me to this.

  • Stacked Canvas and No. of records display on the block?

    Any coding to re-size the "Stacked" canvas and no.of records displays on the block?
    Please advice,
    Amy

    u can set the view port and Width and height of the Stack canvas at runtime but not No of Records display....
    set_view_property .....VIEW_SIZE or Width / Height
    for canvas size use SET_CANVAS_PROPERTY
    Baig
    [My Oracle Blog|http://baigsorcl.blogspot.com/]

  • Different resolutions for Macbook Pro display and External display

    Is it possible to have different resolutions for a Macbook Pro and an external display. I prefer to see less but larger on my Macbook Pro whilst seeing more but smaller on my external display. I use the DVI output to connect to an Acer 22in display.
    Thanks in advance
    Ian

    in4time wrote:
    I've actually tried that process and it doesn't work; I still get the same display qualities on both. Perhaps that process might work if one is not mirroring. Maybe there is a compatibility issue between my Macbook Pro and the Acer 223W. I'll persevere, but thanks for your help anyway.
    Ian
    Hi Ian,
    allow me to chime in:
    You are absolutely correct!
    In 'Mirroring Mode' both internal and external display have the same resolution.
    Only in 'Extended Mode' you can have different resolutions for both displays.
    Regards
    Stefan

  • Report display is different in report builder, local oc4j and app server

    Hi guys,
    we upgrade reports from sql report writer into report 10g. In the report 10g builder,
    the report format looks fine. but if i use the url as below
    http://applicationserver/reports/rwservlet?report=test.rdf&userid=username/password@service&desformat=pdf&destype=cache
    so the format will be mess up whatever i use this url in my local oc4j or i deployed it into 10g application server. and the format is different in oc4j and application server. Why this issue happend?
    Thanks in advance,
    Appcat

    Hello,
    They are a Fix Pack higher than you which may explain why it's broken on their server.
    Download the Fix Pack for R2 and see if you can duplicate the issue.
    Thank you
    Don

  • Sideways and Vertical displays different for the same song

    When I play music on my iPod touch 4th generation, the name of the song appears normally in the vertical position, but the first word is omitted in the sideways display. ("Awake And Alive" displays as "And Alive" when sideways.) How can I fix this?

    Hello Beverly,
    Thank you for the question.  I would be concerned too if I received two emails for the same purchase. 
    I suggest checking your purchase history in the iTunes Store to see if there are two separate charges listed for this song.  Use the steps in the following article to check your purchase history in the iTunes Store:
    iTunes Store: See your purchase history and web order numbers
    http://support.apple.com/kb/HT2727
    If you do in fact see two separate charges for the same song, you can report the issue to the iTunes Store using these steps:
    To report an issue with your iTunes Store, App Store, Mac App Store, or iBooks Store purchase, follow these steps:
    Find the email receipt for your purchase.
    Click Report a Problem under the app that is having the issue.
    When prompted, enter the Apple ID and password you used to purchase the item, then click Report a Problem.
    Click Report a Problem next to the item you are having an issue with.
    From the Choose Problem dropdown menu, choose the appropriate issue.
    Follow the onscreen instructions and—if prompted—type a description of the problem into the text field.
    Click Submit to have your issue reviewed.
    Find the full article here:
    How to report an issue with your iTunes Store, App Store, Mac App Store, or iBooks Store purchase
    http://support.apple.com/kb/ht1933
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • How to display two different parts of one image in two windows?

    hi everyone:) i need to display two different parts of one image in two windows. i have problem with displaying :/ because after creating windows there aren't any images :( i supose my initialization code of creating windows is incomplete, maybe i miss something or maybe there is some inconistency. graphics in java is not my strong position. complete code is below. can anybody help me?
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.io.*;
    import javax.imageio.*;
    import javax.swing.*;
    import java.util.*;
    class ImgFrame extends JFrame
           private BufferedImage img;
           ImgFrame(BufferedImage B_Img, int x, int y, int w, int h)
                   super("d");
                   img=new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
                   img=B_Img.getSubimage(x, y, w, h);
           }//end ImgFrame construction
           public void paint(Graphics g)
                   Graphics2D g2D = (Graphics2D)g;
                   g.drawImage(img, 8, 8, null);
           }//end paint method
           public Dimension getPrefferedSize()
                   if(img==null)
                           return(new Dimension(100,100));
                   else
                           return(new Dimension(img.getWidth(null),img.getHeight(null)));
           }//end of GetPrefferedSize method
    }//end ImgFrame class
    public class TestGraph2D_03 extends Component
           static BufferedImage IMG;
           public static void Load()
                   try
                           IMG=ImageIO.read(new File("c:/test.bmp"));
                   catch(IOException ioe)
                           System.out.println("an exception: "+ioe);
                   }//end try catch
           }//end TestGraph2D_03 construction
           public static void main(String[] args)
                   Load();
                   ImgFrame F1 = new ImgFrame(IMG, 0, 0, 8, 8);
                   ImgFrame F2 = new ImgFrame(IMG, 8, 8, 8, 8);
                   F1.addWindowListener(new WindowAdapter()
                           public void windowClosing(WindowEvent e)
                                   System.exit(0);
                   F1.pack();
                   F1.setVisible(true);
                   F2.addWindowListener(new WindowAdapter()
                           public void windowClosing(WindowEvent e)
                                   System.exit(0);
                   F2.pack();
                   F2.setVisible(true);
           }//end of main method in TestGraph2D_01 class
    }//end of TestGraph2D_03 class

    Never override the paint(...) method of a Swing component.
    If you have a sub image then add the image to a JLabel and add the label to the GUI. No need for custom painting.

  • Is there a way to create a custom screensaver with pics/slides that display for different amounts of time?

    Is there a way to create a custom screensaver with pics/slides that display for different amounts of time? Or even add a "video slide" into the screensaver?
    My business has 3 TVs displayed in our lobby, each with its own apple TV and they are all linked to the same photo stream. Currently the Atv screensaver displays the photostream pictures of our products for the default 3 seconds. We just added pics/slides that now display messages and useful info for our customers but I want that info to be displayed for a longer period of time than the pictures to give people a chance to read it.
    I tried using flickr and powerpoint as a work around but no luck.  I created a slide in powerpoint with play length of 15 secs and saved it as a wmv file.  I added that file to a "screensaver" set in flickr and pointed the Atv screensaver to that flickr set.  It still displays everything, pics and the wmv file at the default 3 sec.
    I know I can increase the duration of all pics in the screensaver to display for longer but the goal is to have the pics display at 3 secs and the info slides to display at 15 secs.

    Welcome to the Apple Community.
    No that's not possible.
    If you have any suggestions that you think might enhance the Apple TV you can send Apple your feedback here 

Maybe you are looking for

  • Fields transferred to payment & contract changes table

    Dear all, I'm having 2 problems: 1). In the payment program (F110) we make a selection based on the field XBLNR of the FI document (which contains a datestamp + 'REPP' or 'REOP' depending on periodic or one time RE posting). Payments are split betwee

  • How to implementing locking mechanism in abap?

    Hi      my program run by different users. I want      to ensure that at a particular point of time only      one instance of my program running, and all others      should be in wait.      if have a solution for this. i can make use of a flag      (

  • I cannot download any CC trial.Can anyone please help me?

    Its been going on for a few weeks now. Whenever I try to download any Adobe CC product trial ,it freezes at 0% and after about 30 minutes ,it gives me a downloading error and gives me the retry option. Please help me anyone..

  • About oracle 10g10.2.0.1.0

    please if some one have time for me solve my problem/ i have the following os micro soft XP professional version 2002 service pack 2 i have install the oracle 10g Ex i give the user name and password if works fine now i have install the oracle 10g 10

  • PDFBox ... Java heap space problem !!

    Hello, I'm using PDFBox trying to read (2) pdf files in it, but both are big in size(About 17 MB) each. Here is an example for what i want to do : public void loadPdfs() {    String pdf1FilePath = "c:\\java long pdf1.pdf";    String pdf2FilePath = "c