Re: Getting a PNG Photo Image

by Puybaret » Tue Nov 02, 2010 5:40 pm

I just tried your code and it worked as expected (under Mac OS X). You don't need to create the BufferedImage instance, and you can call create getOffScreenImage directly, as shown in this test case:

Code: Select all

public class Export3DViewToPNG {
  public static void main(String [] args) throws RecorderException, IOException {
    Home home = new HomeFileRecorder().readHome("test.sh3d");
    HomeComponent3D homeComponent3D = new HomeComponent3D(home);
    BufferedImage image = homeComponent3D.getOffScreenImage(400, 400);
    File file = new File("tmp.png");
    ImageIO.write(image, "png", file);
  }
}
Under which system do you work?