Skip to content

fix(png): add option to exclude cICP chunk from HDR PNG screenshots - #436

Open
Jahbanny wants to merge 4 commits into
crosire:mainfrom
Jahbanny:feature/rec2100pq-icc-update
Open

fix(png): add option to exclude cICP chunk from HDR PNG screenshots#436
Jahbanny wants to merge 4 commits into
crosire:mainfrom
Jahbanny:feature/rec2100pq-icc-update

Conversation

@Jahbanny

@Jahbanny Jahbanny commented Sep 4, 2026

Copy link
Copy Markdown

Problem

Discord fails to render HDR PNG screenshots that contain a cICP chunk. This is a bug in Discord's PNG decoder, not a problem with ReShade's output.

Approach

Instead of permanently removing the cICP chunk (which breaks other viewers that depend on it, such as Apple's image viewer), this PR:

  • Keeps cICP by default — matching the original ReShade behavior
  • Adds an advanced checkbox in Settings > Output to opt out for users hitting the Discord bug

Changes

File Change
deps/stb_image/stb_image_write_hdr_png.h Added include_cicp parameter; cICP only written when enabled; fixed file_size calculation
source/runtime.hpp Added bool _screenshot_include_cicp = true;
source/runtime.cpp Config load/save + pass flag to PNG writer
source/runtime_gui.cpp Checkbox with tooltip: "Uncheck to fix image display issues in Discord"

@Jahbanny
Jahbanny force-pushed the feature/rec2100pq-icc-update branch from 9f2e2ec to e649cff Compare September 4, 2026 19:35
@Jahbanny Jahbanny changed the title Update embedded HDR PNG ICC profile to reference 4,324-byte Rec2100PQ profile fix(png): replace HDR PNG ICC profile with reference Rec.2100 PQ profile Sep 4, 2026
@Jahbanny
Jahbanny force-pushed the feature/rec2100pq-icc-update branch 2 times, most recently from ba016f1 to 590e087 Compare September 4, 2026 19:41
@Jahbanny Jahbanny changed the title fix(png): replace HDR PNG ICC profile with reference Rec.2100 PQ profile fix(png): replace HDR PNG ICC profile with reference Rec.2100 PQ profile and omit cICP Sep 4, 2026
Discord has a bug rendering HDR PNGs with a cICP chunk. Instead of
permanently removing cICP (which breaks Apple and other non-Chromium
viewers that rely on it), keep cICP by default and add an advanced
checkbox in Settings > Output to opt out.

- Added bool _screenshot_include_cicp (default: true) to runtime.hpp
- Added config load/save for SCREENSHOT/IncludeCICP in runtime.cpp
- Added 'Include cICP chunk' checkbox in the HDR screenshot format section
  with tooltip: 'Uncheck to fix image display issues in Discord'
- Extended stbi_write_hdr_png_to_func with an include_cicp parameter
- Fixed file_size calculation to accurately reflect included chunks
@Jahbanny
Jahbanny force-pushed the feature/rec2100pq-icc-update branch from 8473346 to 25cb3a1 Compare September 4, 2026 21:37
@Jahbanny Jahbanny changed the title fix(png): replace HDR PNG ICC profile with reference Rec.2100 PQ profile and omit cICP fix(png): add option to exclude cICP chunk from HDR PNG screenshots Sep 4, 2026
Jacob Bancroft added 3 commits September 4, 2026 16:19
…orkaround

- Restore iCCP chunk writing in stbi_write_hdr_png_to_func (was removed in prior PR)
- iCCP is now always written for BT.2020/PQ, independent of cICP toggle
- Rename checkbox to 'Write cICP tag (Discord HDR bug)' in GUI and resource file
- Update tooltip to clarify it's a Discord bug workaround
@Jahbanny

Jahbanny commented Sep 4, 2026

Copy link
Copy Markdown
Author
123

@Jahbanny

Jahbanny commented Sep 4, 2026

Copy link
Copy Markdown
Author

Checked (Defaulted behavior)

image

@Jahbanny

Jahbanny commented Sep 4, 2026

Copy link
Copy Markdown
Author

Unchecked (Workaround for discord bug)

image

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant