Skip to content

The resulting image is heavily darkened #2

Open

Description

@SaymanDotNet

Hello.
Downloaded, assembled, launched. Specified the path to the safetensors model. Entered a text task. Got the picture. But the picture always turns out (regardless of the request) darkened. The model does not affect the result.
Compiled with VS2022, Windows 10 22H2 (19045.5537).
The result should definitely be lighter.

Image

Image

Activity

  1. IntptrMax commented on May 3, 2025

    @IntptrMax
    Owner

    Hello. Downloaded, assembled, launched. Specified the path to the safetensors model. Entered a text task. Got the picture. But the picture always turns out (regardless of the request) darkened. The model does not affect the result. Compiled with VS2022, Windows 10 22H2 (19045.5537). The result should definitely be lighter.

    Image

    Image

    Maybe you can use a different vae, or use a different sampler.
    Please tell me the model name, vae name and sampler, cfg, steps you have used, I will try it then.

  2. SaymanDotNet commented on May 3, 2025

    @SaymanDotNet
    Author

    model: cyberrealistic_v41BackToBasics.safetensors
    from civitai
    VAE path is empty.
    steps: 30, cfg: 7.0 or 8.0
    prompt (from source): realistic, best quality, 4k, 8k, trees, beach, moon, stars, boat,
    negative prompt: 2d, 3d, cartoon, paintings
    or prompt: car
    cat, dog, etc - darkened result
    sampler from source.

  3. SaymanDotNet commented on May 12, 2025

    @SaymanDotNet
    Author

    I tried different files with models and different queries, including negative ones. The result is always the same - the picture is very dark. There is a suspicion that somewhere the conversion of 16bit to 32bit is not performed correctly. it's dark from here

  4. IntptrMax commented on May 12, 2025

    @IntptrMax
    Owner

    Maybe there are some differences between my sampler and the diffusers, It will take some time to fix.

  5. niksalyan commented on Nov 1, 2025

    @niksalyan

    I think i found the issue
    In SDModel.cs
    instead of
    image = ((image + 0.5) * 255.0f).clamp(0, 255).@byte().cpu();
    The right math would be

    image = (((image + 1f) / 2f) * 255.0f).clamp(0, 255).@byte().cpu();

  6. IntptrMax commented on Nov 3, 2025

    @IntptrMax
    Owner

    I think i found the issue In SDModel.cs instead of image = ((image + 0.5) * 255.0f).clamp(0, 255).@byte().cpu(); The right math would be

    image = (((image + 1f) / 2f) * 255.0f).clamp(0, 255).@byte().cpu();

    You are right. Thanks. I have updated the code.
    But I think there are still some bugs, it will get some black blocks on the image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions