Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using setIccProfile on a PNG file without a profile leads to an invalid (empty) profile name #2354

Open
theres1 opened this issue Sep 14, 2022 · 2 comments · May be fixed by #2355
Open

Using setIccProfile on a PNG file without a profile leads to an invalid (empty) profile name #2354

theres1 opened this issue Sep 14, 2022 · 2 comments · May be fixed by #2355
Labels
bug imageHandler Anything related to specific ImageHandlers

Comments

@theres1
Copy link

theres1 commented Sep 14, 2022

Describe the bug

ICC profile name is stored in a private var profileName_. Its value is set when reading a PNG file but it should also read a value from an ICC profile. Current implementation provides tools to modify ICC profile but makes changing the name of the profile impossible.

To Reproduce

Steps to reproduce the behavior:

  1. Load a png without a profile. profileName_ is set to empty.
  2. use setICCProfile(), profile data is modified but profileName_ remains empty
  3. profile name after the iccp chunk name is exported empty which makes ICC unrecognizable by Chrome, Firefox, Photoshop.
    iCCP�� (69 43 43 50 00 00 in hex ed)
    Line where profileName_ is set
    profileName_ = std::string(chunkData.c_str(), iccOffset - 1);

    Line where profileName_ is used
    outIo.write(reinterpret_cast<const byte*>(profileName_.data()), nameLength) != nameLength ||

Expected behavior

Expecting profileName_ from profile data or at least a method to set a new profileName_

@theres1 theres1 added the bug label Sep 14, 2022
@kmilos kmilos linked a pull request Sep 15, 2022 that will close this issue
@kmilos
Copy link
Collaborator

kmilos commented Sep 15, 2022

Thanks for the report!

@kmilos kmilos added the imageHandler Anything related to specific ImageHandlers label Sep 15, 2022
@kmilos
Copy link
Collaborator

kmilos commented Sep 15, 2022

The suggested fix is only one (simple) option. One could as an alternative (or in addition) specialize the setICCProfile() method for PNGs that allows setting the name (and has this default as well)...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug imageHandler Anything related to specific ImageHandlers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants