UNPKG

iccdev

Version:

The International Color Consortium....promoting and encouraging the standardization of an open color management system with WASM Tools for managing ICC Color Profiles

62 lines (55 loc) 2.09 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>iccFromCube Tool</title> <style> body { font-family: Arial, sans-serif; margin: 20px; } textarea { width: 100%; box-sizing: border-box; } label { display: block; margin-top: 0.5em; } input[type="file"], input[type="text"] { display: block; margin-top: 0.25em; } </style> </head> <body> <h1>iccFromCube Tool</h1> <section> <label>Select .cube LUT File: <input type="file" id="cubeFile" /> </label> <label>Output ICC Filename: <input type="text" id="outputFile" value="output.icc" /> </label> <button onclick="runIccFromCube()">Run Conversion</button> <textarea id="outputLog" rows="20" placeholder="Conversion log will appear here..."></textarea> </section> <script src="iccFromCube.js"></script> <script> const createModule_IccFromCube = createModule; let iccFromCubeInstance; const iccReady = createModule_IccFromCube({ print: text => document.getElementById("outputLog").value += text + "\n", printErr: text => document.getElementById("outputLog").value += "ERR: " + text + "\n" }).then(mod => iccFromCubeInstance = mod); async function runIccFromCube() { await iccReady; const cubeFile = document.getElementById("cubeFile").files[0]; const outputName = document.getElementById("outputFile").value.trim() || "output.icc"; if (!cubeFile) { alert("Please select a .cube file."); return; } const reader = new FileReader(); reader.onload = () => { try { iccFromCubeInstance.FS.writeFile("input.cube", new Uint8Array(reader.result)); iccFromCubeInstance.callMain(["input.cube", outputName]); } catch (err) { console.warn("Conversion error:", err.message); document.getElementById("outputLog").value += "\n[⚠️ Error during conversion.]\n"; } }; reader.readAsArrayBuffer(cubeFile); } </script> </body> </html>