NOTICE! This is a static HTML version of a legacy Fiji BugZilla bug.

The Fiji project now uses GitHub Issues for issue tracking.

Please file all new issues there.

Bug 1021 - image capture not working in linux
image capture not working in linux
Status: RESOLVED FIXED
Product: Fiji
Classification: Unclassified
Component: Plugins
unspecified
PC Linux
: P4 normal
Assigned To: ImageJ Bugs Mailing List
Depends on:
Blocks:
 
Reported: 2015-03-10 18:57 CDT by pg2296
Modified: 2015-03-12 22:38 CDT
4 users (show)

See Also:

Description pg2296 2015-03-10 18:57:03 CDT
I have an image (16 bit) and a zoom to selection (selection is an ROI).
I would like to save the image with the selection and if i click on plugins->utilities->capture image instead of getting the screenshot of the image, i get the screenshot of my background desktop!
IT works in windows though (where analyze particel instead produce a white image and no ROIs!)

Information about your version of Java:

  os.arch => amd64
  os.name => Linux
  os.version => 3.13.0-37-generic
  java.version => 1.8.0_31
  java.vendor => Oracle Corporation
  java.runtime.name => Java(TM) SE Runtime Environment
  java.runtime.version => 1.8.0_31-b13
  java.vm.name => Java HotSpot(TM) 64-Bit Server VM
  java.vm.version => 25.31-b07
  java.vm.vendor => Oracle Corporation
  java.vm.info => mixed mode
  java.awt.graphicsenv => sun.awt.X11GraphicsEnvironment
  java.specification.name => Java Platform API Specification
  java.specification.version => 1.8
  sun.cpu.endian => little
  sun.desktop => gnome
  file.separator => /

The up-to-date check says: REMIND_LATER

Information relevant to JAVA_HOME related problems:

  JAVA_HOME is set to: /usr/local/java/jdk1.8.0_31/jre
  imagej.dir => /opt/Fiji.app

Information about the version of each plugin:

Activated update sites:
ImageJ: http://update.imagej.net/ (last check:20150309091004)
Fiji: http://fiji.sc/update/ (last check:20150310122923)

Files not up-to-date:
  b0038cbf (MODIFIED) 20150310165149 jars/ij-1.49p.jar
Comment 1 Mark Hiner 2015-03-11 07:56:16 CDT
I was able to reproduce this issue. It looks like there's a bug in the ScreenGrabber plugin:
https://github.com/imagej/ImageJA/blob/v1.49p/src/main/java/ij/plugin/ScreenGrabber.java

To clarify slightly, when I run Capture Image on Linux, it does create a second image with the same dimensions as the first. But it's filled with the portion of the desktop background that the image is hovering over.

Also tested with pure ImageJ 1.49p and got an empty image instead.
Comment 2 Curtis Rueden 2015-03-11 11:08:26 CDT
The ScreenGrabber plugin just uses java.awt.Robot#createScreenCapture().

There are numerous bug reports surrounding that method on various flavors of Linux and various versions of the JDK.

Someone with developer skills could try using that method from a test plugin or script, and see if the problem is specific to ImageJ, or a general bug in OpenJDK.

As a workaround for users, I suggest using the OS's built-in screen capturing technique; e.g., gnome-screenshot:

http://www.thegeekstuff.com/2012/08/screenshot-ubuntu/
Comment 3 pg2296 2015-03-11 11:18:02 CDT
Hi Curtis,
Thanks for your reply. Unfortunately I am running this as part of a macro in a loop, and in set of dozens of images.
If you know of any other method to save a current view into a (small) jpg, that works for me as well.
Unfortunately the auto crop command is too “precise”, I need to zoom out a little bit.
Thanks,

Paolo
Comment 4 Federico 2015-03-12 22:38:32 CDT
Dear all,

as Curtis said, the bug does not spawn from the ScreenGrabber plugin, as it simply uses the Robot class from base Java awt (as a proof of this, the snipped area size is correct).
I was able to solve the problem in Linux Mint by turning off the visual effects of Cinnamon. I got a hint from this Oracle bug report, which reports Robot not working correctly with translucent windows:
http://bugs.java.com/view_bug.do?bug_id=7043845

So you should be able to get what you want by simply disabling windows translucency or any special effects the recent Linux windows managers (Gnome3, Unity, Cinnamon) have forced upon us.

Federico