Skip to content

Texture.Save / image encode routes through GDI+ (System.Drawing) — throws PlatformNotSupportedException on Linux/.NET 7+ #3321

Description

@jpenberthy

Release Type: Official Release
Version: 4.3.0.2507
Platform(s): Linux (and any non-Windows)

Describe the bug
StandardImageHelper.Windows.cs implements PNG/JPG/BMP save via System.Drawing, which is
Windows-only since .NET 6 (hard PlatformNotSupportedException since .NET 7). Any
Texture.Save(stream, ImageFileType.Png) — screenshots, tooling, tests — is dead on Linux.

To Reproduce

  1. Linux game, texture.Save(stream, ImageFileType.Png)PlatformNotSupportedException.

Expected behavior
Cross-platform image save for at least PNG.

Additional context
Fix shape: a managed encoder path for non-Windows — stb-style single-file encoders
(e.g. StbImageWriteSharp, MIT) avoid heavy dependencies; ImageSharp is not an option post-4.0
license change. We ship StbImageWriteSharp app-side for all captures; happy to PR the same
into StandardImageHelper behind an OS check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions