Skip to content

sd4j

A Java Stable Diffusion implementation on ONNX Runtime

Visit official site

What sd4j is

The project is described as a Java Stable Diffusion inference implementation built on ONNX Runtime and ported from a C# version.

What you can do with it

  • Run txt2img generation from Java
  • Repeat image generation in the graphical interface
  • Supply negative text with a prompt

Example prompts

  • An astronaut on horseback in a desert wildlife photo
  • A news photo of a sailing ship crossing Martian dunes
  • A professional photo of the Apollo 11 lander in a field

Pros & cons

✓ What we like

  • The sample follows ONNX Runtime usage practices
  • The project is kept in sync with new ONNX Runtime versions

! What to watch out for

  • All code may change because this is a sample
  • No API in the project should be treated as stable

FAQ

What runtime does it use?

The material states inference runs on ONNX Runtime.

What input feature is named?

The material lists negative text input alongside txt2img generation.

Last reviewed: 2026-11-15

More AI image generation tools

View all →

How we review