-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add support for resizing images #60
Comments
Related #20. |
Hey @kaycebasques, actually — yes! Since this was suggested back on #20, I've wondered how it could best work. In my mind, it'd be great to be able to specify a directory, or path glob, along with resize settings. Some examples of that might be:
Something that gives me pause is being able to specify how cropping and other image resizing operations might be specified. However this gets implemented, my primary goal is to keep any required configuration super simple… but I feel we'll still be able to cover most common scenarios. What do you think of all that? |
Think when you get into cropping you're asking for trouble. One thing I'd like is just to ensure no one uploads a print quality 6000 x 3000 image when a 600 x 300 would do! What about a E.g.
Or:
Os something like that. This would scale all images to 600px max width (with the appropriate height would be chosen to maintain aspect ratio) by default, however |
An option to comment-only or keep the PR from merging if an image is found larger than max width would be nice. Personally I'm hesitant to auto-resize images, but definitely see value in automating alerts and requests to contributors. |
Thanks for looking into this. Sorry for missing #20 (I recall searching for related issues… don't know how I missed that). Here's our use case for web.dev:
@bazzadp's proposed config would probably work for us. Here's my first impression of an intuitive config:
I'm assuming it would automatically detect common image filename extensions. |
@kaycebasques alternatively if you also wanted to enforce the
That is provide a 3200 setting rather than ignoring it completely. Wouldn't enforce a |
What would also be really cool (maybe as a stage two) would be to create alternative sizes/formats for
So if you fed it a
|
@bazzadp that config for enforcing I think I've represented our use case and requirements accurately but at this point I should CC @robdodson (our TL) |
I think as a start being able to request that all images that match a particular glob path can be proportionally resized would be good. |
Thanks for sharing your config ideas @kaycebasques & @bazzadp. Unfortunately GitHub Actions doesn't support array objects so we'd need to come up with another way to specify configurations. In general, I really like where this discussion is headed. Thanks for sharing your ideas 😎
Yes! How great would that be!?? Maybe transcoding isn't something you'd want actively committed to a repo, but instead used in a more advanced pipeline that optimised images then packages/deploys in a following build step? 🤔 Either way. Sounds like a great addition. |
Hah, I was literally building something myself for this and realized that the awesome work in this action would be perfect for a few tweaks to reszing (Since sharp already has a super in-depth resizing feature: https://sharp.pixelplumbing.com/api-resize) I was doing it in-place with I was going to fork and hack it together myself, but if I can help in any way for this I'd be interested! 😄 |
On web.dev we never need images larger than
1600px
. I frequently have to ask our contributors to resize their images (in order to keep the repository size down). Are you open to adding image resizing to image-actions or should we look for other solutions?Edit: We never need images within our main content to be more than
1600px
. There are a few exceptions we'd need to specify but I can share more details later.The text was updated successfully, but these errors were encountered: