What is the correct pipeline for exporting an image?

My final goal is to export an image (png, jpg) of selected flat geometries within a rectangular frame. As I can understand the single possible way to utilise ViewCaptureToFile/ViewCaptureToClipboard commands, but:

  1. The commands capture the whole viewport but I need shrink the image only to the chosen rectangle (rid of background).

  2. How to get true color data (a texture or a solid color) on the image without any material and light effect?

scripting or manual solution

1 Like

will you post an example of your desired result? (even if you have to simulate it)

Desired result:
undefined - Imgur
How looks viewport:

Maybe this helps:

1 Like

Thank you, should investigate

you can set the properties of the viewport in the viewport options-

so whatever that pixel dimension is you can set it to reflect that.

I’d then position your geometry appropriately, then make a named view so you can work on it, but return it to it’s proper orientation.

then work in rendered mode, but shut shadows off. layer your geometry as needed, without shadows you can work in the z direction to create your overlaps.


then capture that viewport using the viewport resolution drop down


Printing to an image file will give you the most control over defining what you want to output, but it can be quiet a bit more work than ViewCaptureToFile

1 Like

Hello- one thing is, if what we are looking at is rendered viewport, then set all materials to be self-illuminated, to avoid any lighting effects -

If it is a shaded view a custom version of Shaded with custom materials may help-



@pascal , @theoutside thank you for your advice! It works perfectly to obtain shrinked View Capture output to exact geometry, but I have got corrupted colours eventually compared to the original plugged texture

This is the original texture:
undefined - Imgur

and this is the output of the ViewCaptureToFile command (with enabled self-illuminated for the object material and disabled Reseives and Cast shadows):

Seems they look pretty similar but they aren’t, if to check their colours the original texture has pure Red, Blue and White colours but the output loses accuracy (all colours have impurity of other colours channel)

capture from the shade mode also destroy original RGB color values (set Light method to “No lighting”)

@stevebaer even the Print command gives wrong color output (use it this way: Print > Chose display color > Open in Preveiw > Save .phg file)

1 Like

Hi @sadovshikov, do you get “correct” colors if you change below ?


Hi @clement

Nope, does’t help, note that this problem happens for shading mode as well.
I want to get solely color data without any effect. You can reproduce my problem easily:

  1. Make simple plane
  2. Apply custom material > set color R=0,G=0,B=255
  3. enable “Self illumination”
  1. Switch to render mode and use ViewCaptureToFile or Print command
  2. Check RGB value of the output (I’ve got it by photoshop eyedrop)
    or check it by grasshopper:

as you can see the R and G values are not equal 0

Not here, i get 0,0,255 which is what i entered. I only get correct color display if i change my gamma as described above, self illumination enabled of course. Actually, i’ve been testing color match in the past with a way larger range of colors, but this is on windows not mac.

Is your ambient color set to black 0,0,0 in rendered display mode ?

I’ll fire up the mac now to test there too.


Sorry for the delay, it just updated my Mac which took some time. I Can confirm colors do not display properly on Mac. I’ve used this image for my test:

The picture is displayed in Rendered display mode and loaded into Rhino using the _Picture command which uses self illumination by default. The only setting i changed in Rhino (on Windows and Mac) is the Gamma as outlined above. It is set to 1.0 and “Use linear workflow” is disabled.

Under windows, i get a 100% color match. Under Mac, colors are way off. Note that i neither use Print or ViewCaptureToFile here, i just make a screenshot of the whole display (Print key on Windows, and Command+Shift+4+Space on Mac). Then the image has been put into Photoshop to compare colors with the original using the color pipette.

To exclude color changes by discourse, i’m attaching the reference picture and the screenshots, all saved in png file format as zip file.

ColorTest.zip (2.9 MB)

@pascal and @stevebaer, i’ve tried to investigate what causes the deviation but have not found a reason, at least it’s not caused by ambient light, skylight, shadows etc. Why does it look different on Mac while it seems to match 100% on windows ?


1 Like

Hi Clement, I am way out of my known territory here as far as any explanation goes… the best I can do is to confirm it is different/incorrect on Mac and log a bugtrack item.

@clement - I did this, on my mac:
made a new custom material, with self illumination and color rgb 0,0,255
Set a plan view of a plane with this material to rendered and took a screen shot, sent the screen shot to Windows where I have more image-related software, and checked the color - it was variously 0,0,244 and 0,0,245. The same file captured on Windows the same way has consistent 0,0,255, so I guess that is confirmation…

@clement - if I open a file of a blue swatch created (screen cap of Rhino’s windopw) on mac, in Gimp on Windows, I am warned about a built-in color profile - if I choose to keep it, the blue shows the 0,0,244 but if I choose to discard it, the blue shows 0,0255…

If I ViewCaptureToFile and open the result on Windows there is no warnng and the color is 0,0,255.



Probably, did you set your gamma to 1 or 2.2 ?

That’s interesting. Is the mac using a color profile by default maybe ? I have an M1 using Bigsur but never bothered with these things, at least on mac…


1 Like

@pascal , @clement
Yes, the default macOS colour profile “Apple RGB” causes color distortion if you take a screenshot. But if you switch to “Adobe RGB 1988” a screenshot will take true colours without any color correction.

So, if switch to “Adobe RGB 1988” Colour profile and take a screencap of Rhino’s window on mac with pure blue (R,G = 0, B =255) swatch I get the same (R,G = 0, B =255) color value of the screencap.

But if with the same file I run the ViewCaptureToFile or Print (with chosen “Adobe RGB 1988” colour profile) I get wrong color result

The settings I have used for the file: Abient RGB color = 0 (for Rendered display mode), Gamma =1, “Use linear workflow” disabled, “Self illumination” for material enabled

In conclusion, apparently the color correction happens during ViewCaptureTo or Print commands

@pascal Do you run ViewCaptureToFile on Mac or Window?

Ah…that’s the way to do it :slight_smile: I was looking for a similar solution, so thanks for sharing this youtube video.

Would be nice to see if this manual step-workflow to export image can be automated/scripted in python to be used in GH for a whole bunch of image exports.

Having the CaptureViewport output image to perfectly math the boundaries of the selected object. And set output image pixel size (a.k.a. the dimensions of the viewport properties) to match aspect ratio of the selected geometry. Also I was unaware you’d save Z-depth surface info Rhino, so this has been an insightful topic to read.

My current approach is turning a Srf to Mesh. Then calculate a black/white heightmap with MeshColor. ‘Horster cameraControl tools’ to set Top view to match the boundary of selected object and the ‘Capture View’ by Ladybug’. But this leaves white space around the exported image, so I’ll still need to crop the images in Photoshop afterwards.

Anyway, maybe in the near future this will be an option in GH or own of this app’s.

Hi @crz_06, you might do this using the CaptureToBitmap method and setting SetWindowRect, examples can be found here.


Hello @clement I’m also trying to work on this. This method works well on setting size and window, but instead losses transparency. Do you know any other way that could export image with both correct window area and alpha tunnel?