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

101 lines (91 loc) 3.46 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>iccSpecSepToTiff 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"], input[type="number"], select { margin-top: 0.25em; display: block; } </style> </head> <body> <h1>iccSpecSepToTiff Tool</h1> <section> <label>Output TIFF Filename: <input type="text" id="outputFile" value="output.tif" /> </label> <label>Compression Flag: <select id="compressFlag"> <option value="0">No Compression</option> <option value="1">LZW Compression</option> </select> </label> <label>Separation Flag: <select id="sepFlag"> <option value="0">Contiguous</option> <option value="1">Separated</option> </select> </label> <label>Input Format File: <input type="file" id="inputFile" /> </label> <label>Start Wavelength (nm): <input type="number" id="startNm" value="380" /> </label> <label>End Wavelength (nm): <input type="number" id="endNm" value="730" /> </label> <label>Increment Wavelength (nm): <input type="number" id="incNm" value="10" /> </label> <label>Embedded ICC Profile File (Optional): <input type="file" id="iccFile" /> </label> <button onclick="runSpecSepToTiff()">Run Conversion</button> <textarea id="outputLog" rows="20" placeholder="Output will appear here..."></textarea> </section> <script src="iccSpecSepToTiff.js"></script> <script> const createModule_IccSpecSepToTiff = createModule; let specSepToTiffInstance; const ready = createModule_IccSpecSepToTiff({ print: text => document.getElementById("outputLog").value += text + "\n", printErr: text => document.getElementById("outputLog").value += "ERR: " + text + "\n" }).then(mod => specSepToTiffInstance = mod); async function runSpecSepToTiff() { await ready; const input = document.getElementById("inputFile").files[0]; const icc = document.getElementById("iccFile").files[0]; const outputName = document.getElementById("outputFile").value.trim() || "output.tif"; if (!input) return alert("Please select an input format file."); const args = [ outputName, document.getElementById("compressFlag").value, document.getElementById("sepFlag").value, "input.dat", document.getElementById("startNm").value, document.getElementById("endNm").value, document.getElementById("incNm").value ]; if (icc) args.push("profile.icc"); const reader1 = new FileReader(); reader1.onload = () => { specSepToTiffInstance.FS.writeFile("input.dat", new Uint8Array(reader1.result)); if (icc) { const reader2 = new FileReader(); reader2.onload = () => { specSepToTiffInstance.FS.writeFile("profile.icc", new Uint8Array(reader2.result)); specSepToTiffInstance.callMain(args); }; reader2.readAsArrayBuffer(icc); } else { specSepToTiffInstance.callMain(args); } }; reader1.readAsArrayBuffer(input); } </script> </body> </html>