Skip to content

Problem adding grayscale jpeg file to pdf document with ImageSharp 2.x #441

Open
@Edminsson

Description

@Edminsson

I have a jpg image (JFIF) that uses grayscale (has one color component according to exiftool). Everything works well when I add my image to a pdf document with the current version of PdfSharpCore. But to fix the vulnerabilities in SixLabors.ImageSharp I've updated the ImageSharp nuget to version 2.1.8. When I add the same image to a pdf document the resulting pdf is not displayed correctly and Adobe Acrobat Reader says "Unsifficient data for an image". In version 1.0.4 of ImageSharp the grayscale image is converted to use 3 color components and then ColorSpace DeviceRGB seems to work, but in version 2.x.x the Image is not converted and it keeps the single color component and then ColorSpace DeviceRGB does not seem to work. I've manually changed the ColorSpace of my faulty pdf to DeviceGray and then it works.
As far as I understand JFIF images always use DeviceRGB when added to a pdfDocument in PdfSharpCore.

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