this post was submitted on 14 Apr 2025
9 points (100.0% liked)

.NET

1652 readers
1 users here now

Getting started

Useful resources

IDEs and code editors

Tools

Rules

Related communities

Wikipedia pages

founded 2 years ago
MODERATORS
 

I want to take a screenshot. In Windows, that's a simple Graphics::CopyFromScreen call.

In Linux, I feel a little confused on how to do this. It seems there is a principal and stark distinction between X11 and Wayland, so I have to include both code paths. For either, it seems there is quite a lot of boilerplate code, often tagged as 'may break depending on your configuration, good luck'.

Effectively, what I found is recommended most often is to call ffmpeg to let it handle that. I'm sure that works, but I find it rather unpalatable.

I find this strange. Taking a screenshot is, in my mind at least, supposed to be a straightforward part of a standard library. Perhaps it is, and I just completely missed it? If not, is there a good library that works out-of-the-box on most variants of linux?


Update: Thank you all for the input. I eventually went with calling ImageMagick. It is fast, easy to use, well documented, and supports capturing arbitrary displays with little effort.

you are viewing a single comment's thread
view the rest of the comments
[–] Kissaki 1 points 6 days ago (1 children)

It’s ridiculous how often Microsoft changes their mind.

I'm just glad they still support Windows Forms through all of that. Which is kinda insane through all that. Microsoft holding long term support and maintenance very high.

There's some connecting matter between the technologies as well. Like the XML representation between WPF and MAUI and whatever else there is. Or Razor between ASP.NET MVC, pages, and Blazor. WinUI and Uno plattform are part of MAUI I think? It ends up very confusing, and yes it's numerous technologies. But there are some cross-sections at least.

I'm familiar with Windows Forms, WPF, and Blazor. I disliked the XML UI representation. I've always wanted to look into/prototype the code-style declaration of UI in code rather than XML.

GUI frameworks are always a hassle. Maybe the number of frameworks and diversity is proof that there is inherent complexity that's hard to solve well.

[–] SmartmanApps 1 points 5 days ago

I’ve always wanted to look into/prototype the code-style declaration of UI in code rather than XML

Creating MAUI UI's in C#