Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Don't go above the original 50MP measure

laurenspriem40e4df4fc9af
diff --git a/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart b/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart
index 9ce0af642d..ab38c12eca 100644
--- a/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart
+++ b/mobile/apps/photos/lib/ui/viewer/file/zoomable_image.dart
@@ -476,7 +476,8 @@ class _ZoomableImageState extends State<ZoomableImage> {
"Handling very large image (${_photo.width}x${_photo.height}) by decreasing resolution to ${_maxImagePixels ~/ 1000000}MP to prevent crash",
);
final aspectRatio = _photo.width / _photo.height;
- final targetHeight = sqrt(_maxImagePixels / aspectRatio);
+ final maxPixels = min(50000000, _maxImagePixels);
+ final targetHeight = sqrt(maxPixels / aspectRatio);
final targetWidth = aspectRatio * targetHeight;
imageProvider = Image.file(
@@ -613,7 +614,8 @@ class _ZoomableImageState extends State<ZoomableImage> {
"Compressing very large image (${_photo.width}x${_photo.height}) more aggressively down to ${_maxImagePixels ~/ 1000000}MP",
);
final aspectRatio = _photo.width / _photo.height;
- final targetHeight = sqrt(_maxImagePixels / aspectRatio);
+ final maxPixels = min(50000000, _maxImagePixels);
+ final targetHeight = sqrt(maxPixels / aspectRatio);
final targetWidth = aspectRatio * targetHeight;
compressedFile = await FlutterImageCompress.compressWithFile(