Spaces:
Sleeping
Sleeping
Update index.js
Browse files
index.js
CHANGED
|
@@ -21,7 +21,7 @@ app.get('/resize', async (req, res) => {
|
|
| 21 |
console.log('原始图像大小:', imageBuffer.byteLength);
|
| 22 |
|
| 23 |
// 使用 sharp 库来调整图像大小
|
| 24 |
-
const resizedImageBuffer = await sharp(imageBuffer).resize(
|
| 25 |
console.log('压缩后的图像大小:', resizedImageBuffer.byteLength);
|
| 26 |
|
| 27 |
// 将压缩后的图像转换为 Base64 编码的数据
|
|
|
|
| 21 |
console.log('原始图像大小:', imageBuffer.byteLength);
|
| 22 |
|
| 23 |
// 使用 sharp 库来调整图像大小
|
| 24 |
+
const resizedImageBuffer = await sharp(imageBuffer).resize(200).toBuffer();
|
| 25 |
console.log('压缩后的图像大小:', resizedImageBuffer.byteLength);
|
| 26 |
|
| 27 |
// 将压缩后的图像转换为 Base64 编码的数据
|