asilvas / node-image-steam

A simple, fast, and highly customizable on-the-fly image manipulation web server built atop Node.js
MIT License
169 stars 26 forks source link

Feature request: optionally cap the max pixel count instead of max dimensions #78

Open subtleGradient opened 5 years ago

subtleGradient commented 5 years ago

Use case: we have a bunch of super tall and skinny images. Since they're so tall, they're hitting the originalSteps maximum height limit. But since they're so skinny, they shouldn't be unnecessarily scaled down.

So, I propose calculating a maximum pixel count instead of maximum dimensions.

subtleGradient commented 5 years ago

I'm planning to implement this myself (if I can figure out how ;)

subtleGradient commented 5 years ago

https://github.com/asilvas/node-image-steam/blob/fb47cc78869f4eba84abc825c56cac1b8c0b29b9/lib/router/router-defaults.js#L10

https://github.com/asilvas/node-image-steam/blob/fb47cc78869f4eba84abc825c56cac1b8c0b29b9/lib/processor/processor-defaults.js#L2

https://github.com/asilvas/node-image-steam/blob/fb47cc78869f4eba84abc825c56cac1b8c0b29b9/lib/processor/steps/resize.js#L27-L35