-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resize without distorting (crop and pad) #88
Comments
@dmarcelino thanks for this detailed proposal! Those functionalities are definitely useful. I'm wondering if it would be better to extend the existing Any thoughts? Thanks! |
Hi @EyalAr, thanks for considering my suggestions. I believe the most elegant option would be to extend resize like: The
The text and options can certainly be improved but I think they describe what I'm aiming at. PS: meanwhile I've added another helper method to by toolkit, |
@dmarcelino I propose the following API additions (terminology borrowed from css):
Regarding |
I thought that much, I think that's reasonable.
Good idea to borrow the terminology from CSS, I think those will do just fine.
Agreed. |
Nice! Thank you. |
Thanks for the suggestions and the discussion! |
would be nice to have a proportional resize regardless of the trivialities of it. We programmers live to remove these :) |
Yea came here because I needed proportional re-size. The behavior of contain is non-intuitive (I've never encountered a contain option that pads width + height) in CSS for example contain will shrink the image AND maintain aspect ratio, I believe this is the most common expected behavior. While scale does work here, it'd be better to either make contain work as a resize-proportional (or add the option for such) and/or add a resize proportional method that maintains aspect ratio given a max width/height. |
Hi @EyalAr, I've started using lwip today and so far I'm enjoying it a lot, thanks! My suggestions:
.resizeCrop()
The main reason I picked up lwip was for generating thumbnails which I think is a common use (e.g. #85). For that it's really useful to be able to resize and crop the image to the desired size. So I would like to suggest a:
.resizeCrop()
or extending.resize()
so it receives an options parameter that would allow to specify how to resize, e.g.: default | crop | pad.Below is how I'm achieving this in my helper method:
.resizePad()
Similar idea to resize and crop but, instead of cropping, padding the image with the desired color. I've also wrote a helper method for this but would be comfortable if lwip had native support. This suggestion may be the same request as Issue #68.
My helper method:
resizeProportional()
Just like
resizePad()
except it doesn't really pad. It produces an image that fits the desired size without distorting, cropping or padding.Using helper methods for these is fine but I think lots of people would like to have support for these straight out from lwip. Anyway, lwip is a great tool, regards.
The text was updated successfully, but these errors were encountered: