Skip to content
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

[@astrojs/image] support additional resize options #4438

Merged
merged 19 commits into from
Sep 9, 2022

Conversation

obennaci
Copy link
Contributor

@obennaci obennaci commented Aug 23, 2022

Changes

Add support for additional Sharp resize options; fit, position, background, kernel, withoutReduction and withoutEnlargement.

Fixes #4341

Testing

Manually so far.

Docs

  • Adding the new props/options to docs

@changeset-bot
Copy link

changeset-bot bot commented Aug 23, 2022

🦋 Changeset detected

Latest commit: 12150e4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/image Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Aug 23, 2022
@obennaci obennaci changed the title Feat/image extra options [@astrojs/image] support additional resize options Aug 23, 2022
@matthewp
Copy link
Contributor

@obennaci still marked as draft, is this ready?

@obennaci
Copy link
Contributor Author

Should be good now 👍

@obennaci obennaci marked this pull request as ready for review August 23, 2022 22:28
@tony-sull
Copy link
Contributor

Thanks for opening this, @obennaci!

Looks like I missed the #4341 issue while traveling last week 👀 We're actually still a little too early in the @astrojs/image integration to add more complex transforms to the API right now, unfortunately.

We're working on making Squoosh the default image transformer to add support for web containers and Stackblitz. Sharp will still be an option, but we may paint ourselves into a corner adding support for sharp-specific features early on

I'm going to close this PR for now only because the integration needs a bit more time to bake to make sure the core API surface is the right basis for a 1.0 version of the integration. Hopefully we can pull this back up pretty soon though to revisit how to add more fine-grained transform controls here!

@tony-sull tony-sull closed this Aug 24, 2022
@tony-sull tony-sull reopened this Sep 6, 2022
@tony-sull
Copy link
Contributor

Reopening this PR, we're further down the path towards the Squoosh migration now and I think we should be fine here to add more specific resize options 🥳

@obennaci if you don't mind, I'll get this branch caught up to main and prepped for a final review and merge

PR #4642 came through today and shock loose the sharp vs. Squoosh concerns for me. The APIs are close enough that it won't be a problem to have a few specific checks where the Squoosh loader can just warn that a specific transform option is only supported in sharp

@obennaci
Copy link
Contributor Author

obennaci commented Sep 6, 2022

Happy to hear that, can't wait 🥳

Copy link
Contributor

@tony-sull tony-sull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excited to bring this one back now that we have a better idea of how it will work with Squoosh!

We'll need to add docs and test coverage before merging this in, happy to help answer any questions you have or pick the docs/testing work up on my end to get this across the finish line 👍

packages/integrations/image/src/loaders/index.ts Outdated Show resolved Hide resolved
@obennaci obennaci requested a review from a team as a code owner September 6, 2022 23:06
@Jutanium
Copy link
Contributor

Jutanium commented Sep 7, 2022

On the docs side, it's worth defining the CropFit and CropPosition types, as it currently isn't clear what they represent. You can define them once on the page, and then link to them each time.

@tony-sull tony-sull self-assigned this Sep 8, 2022
Copy link
Contributor

@tony-sull tony-sull left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is excellent, thanks for all the updates here! I'm just running a quick test locally against the astro.build project and then we'll merge this in ready for the next release 🎉

@tony-sull tony-sull merged commit 1e5d8ba into withastro:main Sep 9, 2022
@astrobot-houston astrobot-houston mentioned this pull request Sep 9, 2022
@obennaci obennaci deleted the feat/image-extra-options branch September 9, 2022 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

@astrojs/image should support sharp crop strategies such as attention to find high entropy spots to center on
4 participants