Skip to content

Commit 14c10a4

Browse files
committed
fixes; removed polyfill!
1 parent 8664e50 commit 14c10a4

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

‎flm/fragmentrenderer/html.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,6 @@ def render_cells(self, cells_model, render_context, target_id=None):
14541454
"""
14551455

14561456
_html_body_end_js_scripts_mathjax = r"""
1457-
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
14581457
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
14591458
"""
14601459

‎flm/main/_inspectimagefile.py‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def get_image_file_info_pdf(filename, fp):
4141
}
4242

4343

44+
gif_default_dpi = 96
45+
4446
def get_image_file_info_pil(filename, fp):
4547

4648
import PIL
@@ -59,11 +61,23 @@ def get_image_file_info_pil(filename, fp):
5961
width_px, height_px = img.width, img.height
6062

6163
if 'dpi' not in img.info:
62-
raise ValueError(
63-
"Your image does not provide any DPI information. Please fix "
64-
"your image so that it has a fixed DPI setting. We need this information "
65-
"to know how large your image is."
66-
)
64+
# Some raster formats (notably GIF) have no way to store DPI
65+
# information at all. Rather than failing, assume a sensible default
66+
# DPI for those formats so we can still compute physical dimensions.
67+
if img.format == 'GIF':
68+
logger.warning(
69+
f"GIF image ‘{filename}’ does not (and cannot) carry DPI "
70+
f"information; assuming {gif_default_dpi} DPI. Consider using a "
71+
f"format such as PNG with an explicit DPI setting if you need "
72+
f"precise control over the physical size."
73+
)
74+
dpi_x, dpi_y = gif_default_dpi, gif_default_dpi
75+
else:
76+
raise ValueError(
77+
"Your image does not provide any DPI information. Please fix "
78+
"your image so that it has a fixed DPI setting. We need this information "
79+
"to know how large your image is."
80+
)
6781
else:
6882
dpi_x, dpi_y = img.info['dpi']
6983

0 commit comments

Comments
 (0)