20260607 - login, add scene, add hotspot
This commit is contained in:
@@ -8,10 +8,17 @@ const sharp = require('sharp');
|
||||
const resizeTo8K = async (inputPath, outputPath) => {
|
||||
try {
|
||||
await sharp(inputPath)
|
||||
.rotate() // Tự động xoay ảnh dựa trên EXIF orientation
|
||||
.resize(8192, 4096, {
|
||||
fit: 'fill' // Ensures the output is exactly 8192x4096
|
||||
})
|
||||
.jpeg({ quality: 90 })
|
||||
.jpeg({
|
||||
quality: 85,
|
||||
progressive: false, // Tắt progressive để header đơn giản hơn cho piexifjs
|
||||
chromaSubsampling: '4:2:0'
|
||||
})
|
||||
// Loại bỏ .withMetadata() để Sharp tạo ra file JPEG sạch nhất.
|
||||
// Điều này giúp piexifjs không bị lỗi "Given data is not jpeg".
|
||||
.toFile(outputPath);
|
||||
} catch (error) {
|
||||
throw new Error(`Sharp image processing failed: ${error.message}`);
|
||||
|
||||
Reference in New Issue
Block a user