single-file-core 1.6.18 → 1.6.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -780,10 +780,13 @@ async function resizeImage(doc, dataURI, { imageReductionFactor, imageQuality },
780
780
  }, contentType, quality));
781
781
  }
782
782
  if (blob.type == contentType) {
783
- dataURI = await toDataURI(blob, contentType);
784
- if (element && isUnsizedSVGImage(element)) {
785
- element.setAttribute("width", image.naturalWidth);
786
- element.setAttribute("height", image.naturalHeight);
783
+ const resizedDataURI = await toDataURI(blob, contentType);
784
+ if (resizedDataURI.length < dataURI.length) {
785
+ dataURI = resizedDataURI;
786
+ if (element && isUnsizedSVGImage(element)) {
787
+ element.setAttribute("width", image.naturalWidth);
788
+ element.setAttribute("height", image.naturalHeight);
789
+ }
787
790
  }
788
791
  }
789
792
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "single-file-core",
3
- "version": "1.6.18",
3
+ "version": "1.6.19",
4
4
  "description": "SingleFile Core",
5
5
  "author": "Gildas Lormeau",
6
6
  "license": "AGPL-3.0-or-later",