Skip to content

Commit fcbab57

Browse files
author
Jon
committed
Fix for the getting max dimensions calc
1 parent 138145c commit fcbab57

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

datalab/datalab_session/utils/file_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ def create_jpgs(cache_key, fits_paths: str, color=False, zmin=None, zmax=None) -
6969
large_jpg_path = tempfile.NamedTemporaryFile(suffix=f'{cache_key}-large.jpg').name
7070
thumbnail_jpg_path = tempfile.NamedTemporaryFile(suffix=f'{cache_key}-small.jpg').name
7171

72-
max_height, max_width = max(get_fits_dimensions(path) for path in fits_paths)
72+
max_height = 0
73+
max_width = 0
74+
for path in fits_paths:
75+
dimensions = get_fits_dimensions(path)
76+
max_height = max(max_height, dimensions[0])
77+
max_width = max(max_width, dimensions[1])
7378

7479
fits_to_jpg(fits_paths, large_jpg_path, width=max_width, height=max_height, color=color, zmin=zmin, zmax=zmax)
7580
fits_to_jpg(fits_paths, thumbnail_jpg_path, color=color, zmin=zmin, zmax=zmax)

0 commit comments

Comments
 (0)