From 3e45ab84d60f7b46ef036a0eb0f63103ec808ecd Mon Sep 17 00:00:00 2001 From: John McNamara Date: Tue, 19 Nov 2024 11:25:27 +0000 Subject: [PATCH] image: fix for 0 dpi in png --- xlsxwriter/utility.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xlsxwriter/utility.py b/xlsxwriter/utility.py index 9ff4645f..6a4ae1a6 100644 --- a/xlsxwriter/utility.py +++ b/xlsxwriter/utility.py @@ -1046,7 +1046,7 @@ def _process_png(data): y_density = unpack(">I", data[offset + 12 : offset + 16])[0] units = unpack("b", data[offset + 16 : offset + 17])[0] - if units == 1: + if units == 1 and x_density > 0 and y_density > 0: x_dpi = x_density * 0.0254 y_dpi = y_density * 0.0254