browser-image-compression
browser-image-compression copied to clipboard
[feature] Ability to specify maxWidth or maxHeight
@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 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.
cool. Makes sense. I can take a stab at it, but it might be a week or so before I get a free cycle.