browser-image-compression icon indicating copy to clipboard operation
browser-image-compression copied to clipboard

[feature] Ability to specify maxWidth or maxHeight

Open initplatform opened this issue 5 years ago • 2 comments

@Donaldcwl great work putting this together.

There are certain scenarios that require specifying a maxWidth or a maxHeight specifically. I added both options.

Also added 2 test to test them.

initplatform avatar Apr 09 '20 19:04 initplatform

@initplatform Good suggestions! For the implementation, I think the performance will be better if we combine all three functions handleMaxWidthOrHeight, handleMaxWidth, and handleMaxHeight to one function by calculating the final width and height. It is because separating them will cause unnecessary canvas creation and drawing.

Donaldcwl avatar Apr 23 '20 14:04 Donaldcwl

cool. Makes sense. I can take a stab at it, but it might be a week or so before I get a free cycle.

initplatform avatar May 03 '20 00:05 initplatform