Skip to content
This repository has been archived by the owner on May 5, 2024. It is now read-only.

Commit

Permalink
#15: Resizing wide image failed
Browse files Browse the repository at this point in the history
  • Loading branch information
nbarikipoulos committed Sep 12, 2021
1 parent 84c1681 commit 7945131
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions lib/images.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Copyright (c) 2020 Nicolas Barriquand <nicolas.barriquand@outlook.fr>. MIT licensed. */
/*! Copyright (c) 2020-21 Nicolas Barriquand <nicolas.barriquand@outlook.fr>. MIT licensed. */

'use strict'

Expand All @@ -24,15 +24,9 @@ const createBanner = async (src, tgt, color = DEFAULT_BG_COLOR) => {

const ratio = inputImage.bitmap.width / inputImage.bitmap.height

let w

if (ratio > 2) {
w = UPPER_RIGHT_IMG_WIDTH_MAX
} else if (ratio > 1) {
w *= ratio * UPPER_RIGHT_IMG_HEIGHT_MAX
} else {
w = UPPER_RIGHT_IMG_HEIGHT_MAX
}
const w = ratio < 1.2
? UPPER_RIGHT_IMG_HEIGHT_MAX // "tail" (small ratio) and almost squared images
: UPPER_RIGHT_IMG_WIDTH_MAX // "large" image

const h = UPPER_RIGHT_IMG_HEIGHT_MAX

Expand Down

0 comments on commit 7945131

Please sign in to comment.