Skip to content

refactor(functions/v2/imagemagick): migrate from gm to sharp#4293

Merged
iennae merged 9 commits intoGoogleCloudPlatform:mainfrom
angelcaamal:refactor/imagemagick-sample-v2-gm-to-sharp
Apr 22, 2026
Merged

refactor(functions/v2/imagemagick): migrate from gm to sharp#4293
iennae merged 9 commits intoGoogleCloudPlatform:mainfrom
angelcaamal:refactor/imagemagick-sample-v2-gm-to-sharp

Conversation

@angelcaamal
Copy link
Copy Markdown
Contributor

@angelcaamal angelcaamal commented Apr 20, 2026

Description

Fixes Internal: b/503435756

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed guidelines from CONTRIBUTING.MD and Samples Style Guide
  • Tests pass: npm test (see Testing)
  • Lint pass: npm run lint (see Style)
  • Required CI tests pass (see CI testing)
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • This pull request is from a branch created directly off of GoogleCloudPlatform/nodejs-docs-samples. Not a fork.
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new sample directory, and I created GitHub Actions workflow for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

Note: Any check with (dev), (experimental), or (legacy) can be ignored and should not block your PR from merging (see CI testing).

@angelcaamal angelcaamal requested review from a team as code owners April 20, 2026 22:39
@product-auto-label product-auto-label Bot added api: cloudfunctions Issues related to the Cloud Run functions API. samples Issues that are directly related to samples. asset: pattern DEE Asset tagging - Pattern. labels Apr 20, 2026
@angelcaamal angelcaamal removed api: cloudfunctions Issues related to the Cloud Run functions API. asset: pattern DEE Asset tagging - Pattern. labels Apr 20, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request replaces the gm library with sharp for image processing. The changes include updating the blurring logic to use sharp's asynchronous API, introducing a separate temporary path for blurred images, and ensuring all temporary files are cleaned up in a finally block. Additionally, tests were updated to remove the requirement for system-level ImageMagick installation. A potential issue was identified regarding the sharp version compatibility with the Node.js version specified in the engines field of package.json.

Comment thread functions/v2/imagemagick/package.json
@angelcaamal angelcaamal added the api: cloudfunctions Issues related to the Cloud Run functions API. label Apr 20, 2026
Comment thread functions/v2/imagemagick/index.js Outdated
@iennae
Copy link
Copy Markdown
Contributor

iennae commented Apr 21, 2026

@angelcaamal can you resolve the linting issue I added with the check for the buckets? Thank you!

Overall, this looks like a solid update. I'm wondering whether we can do a streaming version that would simplify the code but we shouldnt' change it here. more details internally, but once you resolve linting I think this is good.

@iennae iennae merged commit c43918f into GoogleCloudPlatform:main Apr 22, 2026
11 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: cloudfunctions Issues related to the Cloud Run functions API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants