-
Notifications
You must be signed in to change notification settings - Fork 59
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
Pdfium's FPDFImageObj_GetRenderedBitmap() function fails if the image object's transformation matrix includes negative a and/or d values. #52
Comments
https://groups.google.com/g/pdfium/c/V-H9LpuHpPY gave a tiny clue to the source of the problem. Seems to be an upstream issue; the question is, can |
Attempted to work around by flipping transformation matrix Additionally, https://github.com/Victor-N-Suadicani reported in #50 (comment) that the returned image size is often smaller than expected. Since the returned image size is determined as part of |
|
The image data returned from The resulting image appears to be sized correctly, which is an improvement from The next thing to try would be dynamically adjusting the image object's translation matrix immediately prior to calling |
Implemented dynamic adjustment of the image object's transformation matrix to coerce Pdfium into returning a bitmap closer in size to that suggested by the image object's metadata. It's slower, since we have to generate the bitmap twice - once to measure its actual dimensions, then a second time at the transformed scale - but it appears to otherwise work well. |
Updated README.md. Bumped crate version to 0.7.22. Waiting for any comments from https://github.com/Victor-N-Suadicani before publishing to crates.io. |
No further comments received. Published to crates.io as version 0.7.22. |
Follow-on from #50.
PdfPageImageObject::get_processed_image()
uses Pdfium'sFPDFImageObj_GetRenderedBitmap()
function to return a bitmap, which is then converted into animage::DynamicImage
. The call toFPDFImageObj_GetRenderedBitmap()
fails if the image object's transformation matrix includes negative values for matrix variablesa
ord
.The text was updated successfully, but these errors were encountered: