Follow

いちいちこういうのかくのがただただめんどくさい・・・

if (img.width > img.height) {
const ratio = img.width / longSizeLength;
outputCanvas.width = longSizeLength;
outputCanvas.height = img.height / ratio;
} else {
const ratio = img.height / longSizeLength;
outputCanvas.width = img.width / ratio;
outputCanvas.height = longSizeLength;
}

Sign in to participate in the conversation
Mastodon

http://twitter.com/cetona