News for hackers. Stuff that matters.
Re:Show HN: Draw A Fish and watch it swim with the others by creata on Friday August 01, 2025 @12:46PM (#44759282)

    const input = document.createElement("input");
    document.body.append(input);
    input.type = "file";
    input.accept = "image/*";
    input.onchange = e => {
        if (input.files && input.files[0]) {
            const canvas = document.getElementById("draw-canvas");
            const ctx = canvas.getContext("2d");
            createImageBitmap(input.files[0]).then(img => ctx.drawImage(img, 0, 0));
        }
    };

There are no comments on this comment yet.