Open villesau opened 4 years ago
What colour would the new pixels be? Transparent?
@jakearchibald I imagined this with transparent background, but it could also stretch the color from outermost pixels. e.g if the topmost pixels are white, remaining space could be filled with white. If the topmost pixels are transparent, remaining pixels would be transparent. It would probably make sense to pick the color from corner pixels since they are least likely to have the actual content I believe.
So I think there could be at least few options:
If I were to choose, I'd go with the option 2. Option 4 would be the safest, but more cumbersome.
Would you be happy with 1 if there was another processor that allowed you to set the background with any value? As that is useful in other cases too.
@jakearchibald for me personally, option 1 would be completely fine since logos often have transparent background. And if there were a way to set background for the picture, then it would achieve the desired flexibility as well which is good.
On the other hand, I got excited of Squoosh because of the simplicity: It does very well almost everything one needs for simple resizing and conversion tasks and nothing more. So I'd be careful regarding potential feature creep. Though, I still feel that setting background color fits into feature set very well! :)
BTW, might be worth to consider removing the squeezing resize altogether in favour of aspect ratio keeping one. I'm not sure if there are any real use cases for functionality like that? If so, you probably really know what you are doing and use some more powerful image manipulation software anyways. Otherwise it's most likely mistake.
Cropping resize is more understandable. Many pics have space around that is OK to crop off.
I don't think resizing without aspect ratio adds much complexity. It certainly doesn't add code. Resizing without aspect ratio is handy if the image you're resizing is anamorphic, such as a DVD video frame.
We might drop the "cover" option in favour of a proper cropping tool.
Is your feature request related to a problem? Please describe. let's say you have 1000px wide and 500px tall image. Now i'd like to resize it to 250x250px. Currently I have two options: To squeeze it horizontally, or cut it horizontally. Both are pretty suboptimal.
Describe the solution you'd like What i'd like is to keep the aspect ration of the original image so that it becomes 250x125.5px. But I'd like to add 62.75px both below and above the image so that it's 250px tall resulting 250x250px image. This is important if you want to resize logos to fit certain places that only allow squares.