[GH-ISSUE #295] Height DPI is incorrectly set to width DPI for PNG and JPEG images #237

Closed
opened 2026-05-05 12:00:47 -06:00 by gitea-mirror · 4 comments
Owner

Originally created by @evanmiller on GitHub (Jun 8, 2020).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/295

Originally assigned to: @jmcnamara on GitHub.

There are bugs in these two lines:

a0d920e589/src/worksheet.c (L2825)
a0d920e589/src/worksheet.c (L2951)

They should read:

object_props->y_dpi = y_dpi ? y_dpi : 96; 
image_props->y_dpi = y_dpi ? y_dpi : 96; 
Originally created by @evanmiller on GitHub (Jun 8, 2020). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/295 Originally assigned to: @jmcnamara on GitHub. There are bugs in these two lines: https://github.com/jmcnamara/libxlsxwriter/blob/a0d920e589b00b264b37ca3c7b7cefa547721a46/src/worksheet.c#L2825 https://github.com/jmcnamara/libxlsxwriter/blob/a0d920e589b00b264b37ca3c7b7cefa547721a46/src/worksheet.c#L2951 They should read: ```C object_props->y_dpi = y_dpi ? y_dpi : 96; ``` ```C image_props->y_dpi = y_dpi ? y_dpi : 96; ```
gitea-mirror 2026-05-05 12:00:47 -06:00
Author
Owner

@jmcnamara commented on GitHub (Jun 8, 2020):

Yikes. Thanks, I'll fix those.

Btw, do you have an image with different X and Y dpi that shows this issue.

I can probably create one but if you have one already that I can use in a test case could you upload it to save time.

<!-- gh-comment-id:640707281 --> @jmcnamara commented on GitHub (Jun 8, 2020): Yikes. Thanks, I'll fix those. Btw, do you have an image with different X and Y dpi that shows this issue. I can probably create one but if you have one already that I can use in a test case could you upload it to save time.
Author
Owner

@evanmiller commented on GitHub (Jun 8, 2020):

I do not have a test file. I discovered this while trying to debug some images being inserted with incorrect aspect ratios - possibly related to #284.

<!-- gh-comment-id:640761030 --> @evanmiller commented on GitHub (Jun 8, 2020): I do not have a test file. I discovered this while trying to debug some images being inserted with incorrect aspect ratios - possibly related to #284.
Author
Owner

@jmcnamara commented on GitHub (Jun 8, 2020):

This isn't related to #284.

No problem. I'll try come up a test case for it.

<!-- gh-comment-id:640795177 --> @jmcnamara commented on GitHub (Jun 8, 2020): This isn't related to #284. No problem. I'll try come up a test case for it.
Author
Owner

@jmcnamara commented on GitHub (Jul 30, 2020):

Fixed on master. Thanks.

<!-- gh-comment-id:666642384 --> @jmcnamara commented on GitHub (Jul 30, 2020): Fixed on master. Thanks.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#237
No description provided.