Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,10 @@ <h2>Online Converter</h2>
const arrayBuffer = await file.arrayBuffer();
const sourceBytes = new Uint8Array(arrayBuffer);

// Await a Promise that resolves when the setTimeout for this image finishes
await new Promise((resolve) => {
setTimeout(() => {
try {
ImageMagick.read(sourceBytes, (image) => {
// Await a short tick to allow the UI to update between images
await new Promise(r => setTimeout(r, 0));
try {
ImageMagick.read(sourceBytes, (image) => {
if (targetExt === 'jpg' || targetExt === 'jpeg') {
image.hasAlpha = false;
}
Expand Down Expand Up @@ -333,14 +332,11 @@ <h2>Online Converter</h2>
}
successCount++;
});
});
} catch(err) {
console.error(`Error processing ${file.name}:`, err);
failCount++;
}
resolve();
}, 50);
});
});
} catch(err) {
console.error(`Error processing ${file.name}:`, err);
failCount++;
}
} catch (err) {
console.error(`Error reading ${file.name}:`, err);
failCount++;
Expand Down