Inspired by manu.ninja approach there's a front-end (or nodejs if using node-canvas) equivalent without using GraphicsMagick:
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');
const image = new Image();
image.onload = () => {
canvas.width = image.width;
canvas.height = image.height;
context.drawImage(image, 0, 0, 1, 1);