[solved] cannot save null image, what's wrong

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
godblessfq
Posts: 94
Joined: Fri Jul 17, 2015 7:40 pm

[solved] cannot save null image, what's wrong

Postby godblessfq » Thu Oct 29, 2015 1:56 pm

Hi everyone,
I got this error when I try to save a screenshot.

Code: Select all

 <unknown exception traceback><type 'exceptions.RuntimeError'>: Cannot save null image.
I think the script the screenshot button runs is:

Code: Select all

Gui.activeDocument().activeView().saveImage('/home/q/Downloads/5.jpeg',733,410,'Current')
I have the latest 0.16 develop edition
OS: Debian GNU/Linux 8.0 (jessie)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.5841 (Git)
Build type: Release
Branch: master
Hash: e7d16c5f620bc4ddded8b8eae97d6e29c0012490
Python version: 2.7.9
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.7.0
Last edited by godblessfq on Thu Oct 29, 2015 5:32 pm, edited 1 time in total.
jmaustpc
Posts: 9566
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: cannot save null image, what's wrong

Postby jmaustpc » Thu Oct 29, 2015 2:20 pm

godblessfq wrote:I think the script the screenshot button runs is:

Code: Select all
Gui.activeDocument().activeView().saveImage('/home/q/Downloads/5.jpeg',733,410,'Current')
I just tried the code you posted, obviously changed the directory, but then it worked for me.

OS: Ubuntu 14.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.5841 (Git)
Build type: Release
Branch: master
Hash: e7d16c5f620bc4ddded8b8eae97d6e29c0012490
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
godblessfq
Posts: 94
Joined: Fri Jul 17, 2015 7:40 pm

Re: cannot save null image, what's wrong

Postby godblessfq » Thu Oct 29, 2015 3:21 pm

Is it because of my GPU? I am using the Fujitsu t580 laptop. It's a pretty new model in 2010.
jmaustpc wrote:two common ways are either tools menu "save picture" which saves a jpeg file of the current view in the model window or use a screen capture application which can take a picture of anything displayed on you screen.

Note that the first one only works if your GPU and its driver support it. Most should, but some pathetic old GPUs do not and some drivers may not implement the feature even when the hardware would.
godblessfq
Posts: 94
Joined: Fri Jul 17, 2015 7:40 pm

Re: cannot save null image, what's wrong

Postby godblessfq » Thu Oct 29, 2015 3:25 pm

If I run the command in the console, a pop up appears and says "unhandled pycxx exeption"
godblessfq
Posts: 94
Joined: Fri Jul 17, 2015 7:40 pm

Re: cannot save null image, what's wrong

Postby godblessfq » Thu Oct 29, 2015 3:27 pm

BTW, what is the pythonic way of refer to a sub object?
I have seen two styles:
1 Gui.activeDocument().activeView().saveImage
2 Gui.activeDocument.activeView.saveImage
The second looks better to me.
jmaustpc
Posts: 9566
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: cannot save null image, what's wrong

Postby jmaustpc » Thu Oct 29, 2015 3:31 pm

godblessfq wrote:Is it because of my GPU?
In the past GPU or its driver has been the problem.

At one time a while ago, I had a Nvidia GPU and found it worked with either opensource or the proprietary drive but not the other.

Most of us use a independent the screen capture application most of the time.
godblessfq
Posts: 94
Joined: Fri Jul 17, 2015 7:40 pm

Re: cannot save null image, what's wrong

Postby godblessfq » Thu Oct 29, 2015 4:04 pm

The same image tool works in an old version install with apt-get on the same machine. Weired.

OS: Debian GNU/Linux 8.0 (jessie)
Word size: 64-bit
Version: 0.14.3702 (Git)
Branch: releases/FreeCAD-0-14
Hash: b3368125c63289ec8ce9faec2b2ae4c78d436406
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
SoQt version: 1.6.0a
OCC version: 6.7.0
godblessfq
Posts: 94
Joined: Fri Jul 17, 2015 7:40 pm

Re: cannot save null image, what's wrong

Postby godblessfq » Thu Oct 29, 2015 5:31 pm

Here is the solution, just need some digging. :)
wmayer wrote:As you solved the issue while I was typing I decided not to reject the content in case someone else has a similar issue.

Open the parameter editor and go to the group: Preferences > Document:

1. There create a boolean key DisablePBuffers and set it to true. Try again.
2. If it doesn't work set the value to false. Try again.
3. If it doesn't work create the boolean key CoinOffscreenRenderer and set it to true. Try again.
4. If it doesn't work then close FreeCAD and set the environment variables:

Code: Select all

COIN_GLXGLUE_NO_PBUFFERS=1
COIN_GLXGLUE_NO_GLX13_PBUFFERS=1
Now restart FreeCAD and try again.
FreeCADUser1
Posts: 1
Joined: Tue Jun 19, 2018 2:56 pm

Re: [solved] cannot save null image, what's wrong

Postby FreeCADUser1 » Tue Jun 19, 2018 3:44 pm

Remote desktop issue

Interestingly, I saw differing behaviour between 0.14 and 0.17 on win7 over remote desktop

while sat at the win7 machine (local) with both versions installed, I could save images with no problems in both versions of Freecad.
(simple box generated from new)

However, remotely..

I could only save images (several file formats) using 0.14
Using 0.17 - I got an error
<unknown exception> cannot save null image

I tried both the suggested Boolean operators, DisablePBuffer and CoinOffRender, both had no effect.

I'm guessing the remote OS is selecting different graphics cards when running the different versions (0.14 and 0.17), but have no idea.
Hard to determine which card is being used as I have an intergrated GPU card(s) with no control options (unlike NVidia)
Intel HD 4600 and AMD Radeon 8750A

I also tested the 32 and 64-bit versions, and had the same result.

As a workaround for 0.17, the print screen command works.
User avatar
fosselius
Posts: 344
Joined: Sat Apr 23, 2016 10:03 am

Re: [solved] cannot save null image, what's wrong

Postby fosselius » Wed Jan 16, 2019 9:31 pm

I get this issue with 0.18 appimg and are unable to solve it with the steps above, i have an intel based laptop, no dedicated graphics

OS: Ubuntu 18.10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15611 (Git)
Build type: Release
Branch: master
Hash: 64a94ae0f7c60fc981086fe157150a9c0dca29c6
Python version: 2.7.15+
Qt version: 5.11.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)