Skip to content

C2paBuilder::add_ingredient does not add the ingredient's thumbnail #90

@kostiantynperehuda

Description

@kostiantynperehuda

When adding a signed image as an ingredient with C2paBuilder::add_ingredient to the image manifest, the resulting manifest does not include ingredient's thumbnail. Here is what the output image produced by tests/builder.test.cpp::TEST(Builder, SignFile) looks like in the validator:

Image

I've also modified the test to explicitly include the thumbnail of the ingredient as a resource, as shown in the chore(doc): add example of thumbnail #89 pr, below is my version:

        string ingredient_json = c2pa::read_ingredient_file(signed_image_path, output_path.parent_path());
        auto ingredient_json_obj = nlohmann::json::parse(ingredient_json);
        std::string resource_id = ingredient_json_obj["thumbnail"]["identifier"];

        ingredient_json = "{\"title\":\"Test Ingredient\"}";
        builder.add_resource(resource_id, signed_image_path);
        builder.add_ingredient(ingredient_json, signed_image_path);

The result is the same: no thumbnail of the ingredient image is displayed.
Note that the ingredient image does in fact contain its own thumbnail, which can be displayed by the validator, but it gets lost as soon as this image becomes an ingredient of another image.
I also tried extracting ingredient's thumbnail data bytes directly from the ingredient image using the C2paReader api, and including these bytes as a resource, the issue still persisted.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions