Skip to content

Commit

Permalink
Fix rounding
Browse files Browse the repository at this point in the history
  • Loading branch information
mifi committed Oct 25, 2020
1 parent 7be4350 commit 8e0cc3c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sources/videoFrameSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const { rgbaToFabricImage, blurImage } = require('./fabric');
module.exports = async ({ width: canvasWidth, height: canvasHeight, channels, framerateStr, verbose, logTimes, ffmpegPath, ffprobePath, enableFfmpegLog, params }) => {
const { path, cutFrom, cutTo, resizeMode = 'contain-blur', speedFactor, inputWidth, inputHeight, width: requestedWidthRel, height: requestedHeightRel, left: leftRel = 0, top: topRel = 0, originX = 'left', originY = 'top' } = params;

const requestedWidth = requestedWidthRel ? requestedWidthRel * canvasWidth : canvasWidth;
const requestedHeight = requestedHeightRel ? requestedHeightRel * canvasHeight : canvasHeight;
const requestedWidth = requestedWidthRel ? Math.round(requestedWidthRel * canvasWidth) : canvasWidth;
const requestedHeight = requestedHeightRel ? Math.round(requestedHeightRel * canvasHeight) : canvasHeight;

const left = leftRel * canvasWidth;
const top = topRel * canvasHeight;
Expand Down

0 comments on commit 8e0cc3c

Please sign in to comment.