Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8020618

[macosx] java.awt.Robot makes blurry screen captures on Retina

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version " 1.7.0_40-ea "
      Java(TM) SE Runtime Environment (build 1.7.0_40-ea-b28)
      Java HotSpot(TM) 64-Bit Server VM (build 24.0-b47, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Darwin munit-065 12.4.0 Darwin Kernel Version 12.4.0: Wed May 1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      MacBook Pro
      Retina, 13-inch, Late 2012
      Processor 2.9 GHz Intel Core i7
      Memory 8 GB 1600 MHz DDR3
      Graphics Intel HD Graphics 4000 768 MB
      Software OS X 10.8.4 (12E55)

      A DESCRIPTION OF THE PROBLEM :
      createScreenCapture method of java.awt.Robot makes blurry screen captures on Retina devices

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      try {
        Robot robot = new Robot(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice());
        BufferedImage capture = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
        ImageIO.write(capture, " png " , new File( " /tmp/capture.png " ));
      } catch (Exception ignore) {}


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      On Retina device I expect 600x600 image with exactly the same picture that I see on Retina display

      http://bulenkov.com/images/retina-capture.png
      ACTUAL -
      [0,0,600,600] was captured and saved into 300x300 image

      http://bulenkov.com/images/robot-capture.png

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      try {
        Robot robot = new Robot(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice());
        BufferedImage capture = robot.createScreenCapture(new Rectangle(0, 0, 300, 300));
        ImageIO.write(capture, " png " , new File( " /tmp/capture.png " ));
      } catch (Exception ignore) {}
      ---------- END SOURCE ----------

            serb Sergey Bylokhov
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: