Skip to content

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

@theres1

Description

@theres1

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_

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugimageHandlerAnything related to specific ImageHandlers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions