[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!
Post Reply
godblessfq
Posts: 110
Joined: Fri Jul 17, 2015 7:40 pm

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

Post by godblessfq »

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
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: cannot save null image, what's wrong

Post by jmaustpc »

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: 110
Joined: Fri Jul 17, 2015 7:40 pm

Re: cannot save null image, what's wrong

Post by godblessfq »

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: 110
Joined: Fri Jul 17, 2015 7:40 pm

Re: cannot save null image, what's wrong

Post by godblessfq »

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

Re: cannot save null image, what's wrong

Post by godblessfq »

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
Veteran
Posts: 11207
Joined: Tue Jul 26, 2011 6:28 am
Location: Australia

Re: cannot save null image, what's wrong

Post by jmaustpc »

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: 110
Joined: Fri Jul 17, 2015 7:40 pm

Re: cannot save null image, what's wrong

Post by godblessfq »

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: 110
Joined: Fri Jul 17, 2015 7:40 pm

Re: cannot save null image, what's wrong

Post by godblessfq »

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

Post by FreeCADUser1 »

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: 381
Joined: Sat Apr 23, 2016 10:03 am
Contact:

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

Post by fosselius »

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)
Post Reply