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: implement loadImage function #483

Merged
merged 7 commits into from
Jun 26, 2022

Conversation

twlite
Copy link
Contributor

@twlite twlite commented Jun 25, 2022

This PR implements the loadImage function, similar to node-canvas's loadImage.

It should support following sources:

  • Buffer
  • Image instance
  • data uri
  • remote url
  • file path/url

API

import { loadImage } from "@napi-rs/canvas"

const image = await loadImage("...")
ctx.drawImage(image, ...)

@twlite twlite marked this pull request as ready for review June 26, 2022 10:15
index.js Outdated Show resolved Hide resolved
@twlite twlite requested a review from Brooooooklyn June 26, 2022 14:46
Copy link
Owner

@Brooooooklyn Brooooooklyn left a comment

Choose a reason for hiding this comment

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

Thank you!

@Brooooooklyn Brooooooklyn merged commit fa0d857 into Brooooooklyn:main Jun 26, 2022
@twlite twlite deleted the feat/loadImage branch June 26, 2022 18:12
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.

2 participants