# Offscreen Rendering

**URL:** <https://discuss.avogadro.cc/t/offscreen-rendering/7564>\
**Category:** Development\
**Created:** [October 26, 2026, 4:46pm UTC](https://discuss.avogadro.cc/t/offscreen-rendering/7564 "2026-10-26T16:46:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [October 26, 2026, 4:46pm UTC](https://discuss.avogadro.cc/t/offscreen-rendering/7564/1 "2026-10-26T16:46:49Z")

</div>

Okay, planning for this took some help from Claude Code in terms of creating a new OpenGL framebuffer, but the code was surprisingly straight-forward:

> <https://github.com/OpenChemistry/avogadrolibs/pull/3236/>
>
> Developer Certificate of Origin
> Version 1.1
> 
> Copyright (C) 2004, 2006 The Linux …Foundation and its contributors.
> 1 Letterman Drive
> Suite D4700
> San Francisco, CA, 94129
> 
> Everyone is permitted to copy and distribute verbatim copies of this
> license document, but changing it is not allowed.
> 
> 
> Developer's Certificate of Origin 1.1
> 
> By making a contribution to this project, I certify that:
> 
> (a) The contribution was created in whole or in part by me and I
> have the right to submit it under the open source license
> indicated in the file; or
> 
> (b) The contribution is based upon previous work that, to the best
> of my knowledge, is covered under an appropriate open source
> license and I have the right under that license to submit that
> work with modifications, whether created in whole or in part
> by me, under the same open source license (unless I am
> permitted to submit under a different license), as indicated
> in the file; or
> 
> (c) The contribution was provided directly to me by some other
> person who certified (a), (b) or (c) and I have not modified
> it.
> 
> (d) I understand and agree that this project and the contribution
> are public and that a record of the contribution (including all
> personal information I submit with it, including my sign-off) is
> maintained indefinitely and may be redistributed consistent with
> this project or the open source license(s) involved.
> 
> 
> 
> 
> 
> 
> \## Summary by CodeRabbit
> 
> \* \*\*New Features\*\*
> \* Render images at custom dimensions, with 1×, 2×, and 4× size presets, optional aspect-ratio locking, and transparent backgrounds.
> \* Choose supersampling for higher-quality image output, including through the Python rendering interface.
> \* Export movie frames at a selected size using the rendered scene.
> \* \*\*Bug Fixes\*\*
> \* Improved consistency of transparency and rendering across exported images and movie frames.
> \* Movie encoding now tries an available video encoder and reports when encoding cannot start.

Before I merge this, I’d like to get some testing esp. on Linux and Windows, for example just File ⇒ Export Graphics or Edit ⇒ Copy Graphics

There’s a new dialog for Export Graphics, allowing you to set a size or ratio (e.g., 2x, 3x) and a transparent background:

 ![image](https://discuss.avogadro.cc/uploads/default/original/2X/7/77421bf75cb7faaeacaaedf25cc7995bd4bc0174.jpeg)

This also means that the movie recording (from animation) can set to exactly 800x600, etc.

Claude also suggested a slightly different transparent blending mode which seems to give the volumetric and surface rendering translucency when I paste on slides…

---

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [October 26, 2026, 4:48pm UTC](https://discuss.avogadro.cc/t/offscreen-rendering/7564/2 "2026-10-26T16:48:48Z")

</div>

I’d also welcome some volunteers to run some rendering benchmarks. I have a M4 MacBook, which is evidently about the same as a GeForce GTX 1650 Laptop. I’d be curious to see how integrated graphics and dedicated GPUs handle larger trajectories on Linux and Windows. (My guess is that I’m somewhere in the middle - some users have older hardware and some have better GPUs.)

---

<div class="post-metadata">

**Author:** ![Thomas](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/thomas/32/3403_2.png) [@Thomas](https://discuss.avogadro.cc/u/Thomas)\
**Post date:** [October 26, 2026, 10:05pm UTC](https://discuss.avogadro.cc/t/offscreen-rendering/7564/3 "2026-10-26T22:05:12Z")

</div>

I’m not sure if I understand the simultaneous presence of width and height on one hand, and size of view on the other. Is this to say the illustration should be for instance twice as large as currently seen on the computer’s screen?

On the other hand, because Avogadro generates both vector illustrations (svg) as well as bitmap (png, which the interface is about), I could imagine _a pulldown_ menu with a couple of presets. This draws inspiration from [irfanview](https://www.irfanview.com/). This could consist of

- a few small presets, e.g. 800 x 600 px (for a lightweight preview), or 1280 x 720 px for an attachment to an email
- a couple presets in a tune like “3.33 in x 300 dpi = 999 px width” for an ACS single column illustration, similar for a two-column illustration; similar for a couple of other publishers (e.g., RSC, Wiley, Elsevier, etc.). This derives the pattern of molecule editors (ChemDraw and alike).
- a user defined dimension one can reuse at a later time (similar to a personal style), separate from _just this time_ the canvas will be dialed to 2172 x 1988 px.

---

<div class="post-metadata">

**Author:** ![ghutchis](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/ghutchis/32/456_2.png) [@ghutchis](https://discuss.avogadro.cc/u/ghutchis)\
**Post date:** [October 26, 2026, 11:21pm UTC](https://discuss.avogadro.cc/t/offscreen-rendering/7564/4 "2026-10-26T23:21:02Z")

</div>

> [@Thomas](#):
>
> illustration should be for instance twice as large as currently seen on the computer’s screen

Yes, or multi-scaling, e.g. generate a 800 x 600 image from a 1600 x 1200 - rescaled to minimize artifacts. Certainly _movies_ have fairly standardized sizes and aspect ratios.

I’m definitely looking for feedback here. The 300 dpi idea is good.

IIRC it saves whatever dimension you set for the next time you export, so the user-defined dimension is there.

---

<div class="post-metadata">

**Author:** ![colorfulcms](https://discuss.avogadro.cc/letter_avatar_proxy/v4/letter/c/8491ac/32.png) [@colorfulcms](https://discuss.avogadro.cc/u/colorfulcms)\
**Post date:** [October 27, 2026, 12:56pm UTC](https://discuss.avogadro.cc/t/offscreen-rendering/7564/5 "2026-10-27T12:56:22Z")

</div>

This is great to see, especially for the animation side. One small thing from working with video encoding a lot: if the movie export goes to H.264/MP4 with the usual yuv420p pixel format, both width and height have to be even numbers, otherwise ffmpeg either refuses or silently pads/crops by a pixel. So if users can type a custom size or pick a scale factor, it might be worth rounding the offscreen framebuffer to even dimensions for movie output (PNG/SVG can of course stay exact).

For presets, 1280x720 and 1920x1080 cover most video platforms, and 1080x1080 is handy for square social posts. I’m happy to run the trajectory benchmark on Linux with integrated Intel graphics once there’s a test build or a script to run.

---

<div class="post-metadata">

**Author:** ![Thomas](https://discuss.avogadro.cc/user_avatar/discuss.avogadro.cc/thomas/32/3403_2.png) [@Thomas](https://discuss.avogadro.cc/u/Thomas)\
**Post date:** [October 27, 2026, 10:10pm UTC](https://discuss.avogadro.cc/t/offscreen-rendering/7564/6 "2026-10-27T22:10:41Z")

</div>

The dimensions of the drawing pane are adjustable (manually as well as by splits by dividers), and resolutions of a screen vary from one to the next device and setup in the operating system. Thus an indicator about the present dimensions (in px) were helpful _as such_ or with the 1x, 2x, 4x multiplier `Size of preview` by the widget proposed above. Personally, I like Jmol’s approach (at the bottom of the frame, outside the actual canvas; automatic update if the frame’s dimension change by drag-and-drop with a mouse) with a bar like

![jmol_dimension_indicator](https://discuss.avogadro.cc/uploads/default/original/2X/c/c3b8c9b2f9c5fce04fb455ea1babe424bb151b47.png)

– here about a canvas of 500 px (width) times 400 px (hight).
