@gallop.software/studio 2.3.122 → 2.3.124

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.
@@ -11,7 +11,7 @@
11
11
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
12
12
  }
13
13
  </style>
14
- <script type="module" crossorigin src="/assets/index-BQQJsRCn.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-CCdX8oov.js"></script>
15
15
  <link rel="stylesheet" crossorigin href="/assets/index-DfPQBmNf.css">
16
16
  </head>
17
17
  <body>
@@ -4463,7 +4463,8 @@ import sharp7 from "sharp";
4463
4463
  async function handleEditImage(request) {
4464
4464
  try {
4465
4465
  const body = await request.json();
4466
- const { imagePath, crop, rotation, resize } = body;
4466
+ const { imagePath, crop, rotation, resize, quality = 95 } = body;
4467
+ const outputQuality = Math.max(1, Math.min(100, quality));
4467
4468
  if (!imagePath || !imagePath.startsWith("public/")) {
4468
4469
  return jsonResponse({ error: "Invalid image path" }, { status: 400 });
4469
4470
  }
@@ -4504,13 +4505,13 @@ async function handleEditImage(request) {
4504
4505
  const ext = path10.extname(imagePath).toLowerCase();
4505
4506
  let finalBuffer;
4506
4507
  if (ext === ".png") {
4507
- finalBuffer = await pipeline.png({ quality: 85 }).toBuffer();
4508
+ finalBuffer = await pipeline.png({ compressionLevel: 9 }).toBuffer();
4508
4509
  } else if (ext === ".webp") {
4509
- finalBuffer = await pipeline.webp({ quality: 85 }).toBuffer();
4510
+ finalBuffer = await pipeline.webp({ quality: outputQuality, lossless: outputQuality === 100 }).toBuffer();
4510
4511
  } else if (ext === ".gif") {
4511
4512
  finalBuffer = await pipeline.gif().toBuffer();
4512
4513
  } else {
4513
- finalBuffer = await pipeline.jpeg({ quality: 85 }).toBuffer();
4514
+ finalBuffer = await pipeline.jpeg({ quality: outputQuality, mozjpeg: true }).toBuffer();
4514
4515
  }
4515
4516
  const finalMeta = await sharp7(finalBuffer).metadata();
4516
4517
  const finalWidth = finalMeta.width || resize.width;