-
Notifications
You must be signed in to change notification settings - Fork 130
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
Certain PNG images are skewed when rendering in Core build of PDFsharp #168
Comments
Both the GDI and WPF builds handle the image correctly. |
First, thanks for looking into this! I am new to PDFsharp and I have to say I'm very impressed with it. We are specifically using the Core build to avoid GDI and WPF dependencies, unfortunately. May I ask what you used to convert the PNG to a monochrome BMP file? I tried to do that using Magick.NET and was unable to get monochrome output -- I ended up with an 8-bit image no matter what I tried. I'm limited by avoiding the System.Drawing namespace, otherwise I would have many viable options. Brent |
I used the good old Paint |
Ah, I'm in need of a programmatic solution. The full story is that our application deals with a wide variety of image formats and we need to convert any that are not of a PDFsharp-supported format (JPG, PNG, BMP for Core) to a supported format for inclusion in a generated PDF. The PNG in question was actually converted from a bitonal TIFF image using ImageGear.NET (we have an ImageGear license). At first I thought the blame here was with ImageGear's conversion, but the PNG seems valid and I can open it using a variety of applications. I will go back and try converting from TIFF to BMP using ImageGear and see if the BMP file generated that way is acceptable. By the way, were you able to reproduce the skewing issue using the submitted code (using the Core library)? Thanks again, |
Yes. Shame on me. My monochrome test images always had widths that are a multiple of 8. So the next preview of PDFsharp will handle this particular image correctly. Cannot yet give an ETA. |
That's great! I'm glad you've discovered the issue and I thought it was probably width related, based on the skewed output. I'm glad I could add a file to your image test library. :) I think I might have a JPEG file that I had a different issue with. If I can find it I'll submit an issue for that as well. Not that I'm trying to be a troublemaker or anything... Regards, |
I just found out that the bug was not my original work, but already existed in the PNG library we use for the import. I feel a little bit better now. JPEG files come in many different flavors and we added two more flavors in the past few months, but maybe there are more to come. |
@ThomasHoevel, will your fix still work despite the bug in the PNG library (BigGustave, it appears)? |
PDFsharp includes an enhanced BigGustave library - now with the fix. |
Expected Behavior
I expect the PNG image to render correctly. The PNG in question seems to be valid and is viewable elsewhere (MS Paint, GIMP, Chrome, etc.).
Actual Behavior
The PNG file is rendered skewed. Please see the image below:
Steps to Reproduce the Behavior
Please see the example in the attached issue submission. A PNG file that demonstrates the issue is included.
Issue.zip
Thank you,
Brent Southard
[email protected]
The text was updated successfully, but these errors were encountered: