Skip to content

Instantly share code, notes, and snippets.

@cjohansen
Created October 17, 2014 08:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cjohansen/a6ba97342b6c0f06779e to your computer and use it in GitHub Desktop.
Save cjohansen/a6ba97342b6c0f06779e to your computer and use it in GitHub Desktop.
function setPixelAspectRatio(ratio) {
var canvas = document.createElement('canvas');
canvas.width = originalImage.width * ratio;
canvas.height = originalImage.height;
var ctx = canvas.getContext('2d');
ctx.scale(ratio, 1);
ctx.drawImage(originalImage, 0, 0);
imageEditor.loadImage(canvas);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment