-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
ICML Writer: Image object does not fit to frame #6936
Comments
I see, so the dimensions are applied to the frame, but the image itself is not changed? |
Yes, the scaling of the image does not fit the frame, sometimes the image is smaller than the frame (as in the example), sometimes it is bigger, but I haven't managed to identify a pattern. |
@ksesong I think I've fixed this with #6946... testing certainly welcome... @jgm seems he needs to build from source, or wait until we merge it and test the nightly build? as https://github.com/jgm/pandoc/actions/runs/417415033 doesn't have any artifacts... |
I've merged, so there should be a nightly available tomorrow. |
I have tried the I thought these images were invalid, but |
I don't see what could be problematic about this image.
The dpi of 143 is a bit odd. Interestingly, macos Preview says the dpi for this image is 144. So maybe pandoc has an off-by-one-error? |
The invalid image is this one, not the screenshot that I included in the comment (which is valid). Sorry for the confusion. |
The problem seems indeed to be in jpegSize: for test-2:
for test-2-resave.jpg (which is after resaving the file in Photoshop and which seems correct):
|
Wait, I thought the problematic image was the one displayed above -- which is a png. |
But I can confirm the results you're seeing for image-size on the jpg from test-2. |
This is an exif file. |
|
Since we depend on JuicyPixels anyway, I'm going to try changing ImageSize to use its metadata parsing instead of doing my own binary parsing. |
...for png, jpeg, gif, instead of doing our own binary parsing. See #6936.
All my images now work with the |
I have reviewed more images, and I have identified one regression, an image that fitted correctly after #6946, and no longer fits now. Re-saving the image did not solve the issue however. The image is question is test-3.jpg. |
For test-3.jpg, pandoc's imageSize calculates
Is this incorrect? |
pandoc's |
hm... even:
|
Prior to the change to using JuicyPixels, with our old hand-band bit twiddling, we got:
So this is indeed a regression, and possibly a bug in JuicyPixels. |
Here is the full metadata as returned by JuicyPixels:
|
We can see the correct width and height here:
and the one we are getting comes from
Looking up the exif tag codes:
|
Clearly in this case need to be using the ExifImageHeight/Width instead of the things JuicyPixel identifies as Width and Height. (But where are those numbers coming from?) |
OK, though I'm still not sure where the Width and Height identified by JuicyPixels are coming from, I've worked around this, by checking first for the Exif tags. I think this should work fine for both exif and other images, but of course further testing is welcome! |
I confirm that this is now working for all the images I have in hand. |
I have another edge case. When using This example image was created using Adobe Illustrator's "Export for Screens..." function, so this is a relatively frequent situation. |
@ksesong why don't you open a new issue for this. |
Given an image set up using the following markdown string
![](./test.png){width=15cm}
, the resultingicml
file does not create an image object that fits to the frame, here is a screenshot in InDesign:(The brown rectangle corresponds to the image object, and the blue one to the image frame.)
I have copied the test files onto a dedicated repository
ksesong/pandoc-image-fitting
, with theicml
file compiled frompandoc 2.11.2
. The problem is not specific to this particular image file, and I've tried various width units for the same effect.The text was updated successfully, but these errors were encountered: