Closed julienrffr closed 5 months ago
Attached files are legit JPG though so maybe those checks are too strict?
We want to be sure they are JPEG images after all. If there are JPEG variations that are not yet recognized, there is no problem to add them.
It seems that both images are APP2 ICC_Profile (header 0xffe2) JPEG pictures. See https://exiftool.org/TagNames/JPEG.html
Fix provided in PR https://github.com/empira/PDFsharp/pull/82
fixed in 6.1.0
In 6.1.0-preview-1 (and in 6.0.0 as well), using Core build,
Take the HelloWorld program of Core build, Add:
var imageStream = File.Open(@"C:\Users\xxx\Downloads\MI6LOGO.jpg", FileMode.Open, FileAccess.Read); XImage xImage = XImage.FromStream(imageStream); gfx.DrawImage(xImage, 0, 0, 100, 100);
Where MI6LOGO.jpg is one of those attached files: It will throw an exception 'Unsupported format' because it does not find expected jpg headers in ImageImporterJpeg.cs in method TestJfifHeader: https://github.com/empira/PDFsharp/blob/b28bc3265e0a15302c04b7b91da0d915a591e167/src/foundation/src/PDFsharp/src/PdfSharp/Drawing.Internal/ImageImporterJpeg.cs#L70The 3 sub-methods used to determine value of the 'header' boolean return false.
Attached files are legit JPG though so maybe those checks are too strict?