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

feat(image-sharp): add trim option #14137

Merged
merged 3 commits into from
May 31, 2019
Merged

Conversation

cpboyd
Copy link
Contributor

@cpboyd cpboyd commented May 18, 2019

Description

Add the @lovell/sharp trim option (and standardize fit & background from fluid to fixed).

I was trying different sharp options with a list of video screenshots (currently using fixed()), some of which have black bars, and saw that sharp offered a trim option.

Further, the fit and background settings weren't available on fixed.

Note: My original plan was to have it accept either a boolean or int, with true representing the sharp default threshold. (currently 10)

Unfortunately, per graphql/graphql-spec#488, GraphQL doesn't accept union types as inputs currently. GraphQLInt coalesces true to 1 and false to 0 (0 is an invalid threshold value, so it's still OK to use to disable the setting)

Related Issues

Copy link
Contributor

@freiksenet freiksenet left a comment

Choose a reason for hiding this comment

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

I don't think there is much value to split the argument into a boolean and a float, it'd be pretty easy for the user to pass trim default value as an argument, so there is no need to complicate the API further.

@cpboyd
Copy link
Contributor Author

cpboyd commented May 25, 2019

@freiksenet I made the requested changes, but squashed the prior commits before pushing the new changes which may have interrupted the normal review workflow.

Do I need to do make any other changes?

freiksenet
freiksenet previously approved these changes May 31, 2019
@freiksenet freiksenet merged commit cf0e77b into gatsbyjs:master May 31, 2019
johno pushed a commit to johno/gatsby that referenced this pull request Jul 17, 2019
* feat(sharp): add trim option

* fix: trim option only as number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants