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

change Buffer to Uint8Array in fromRgbaPixels #41

Merged
merged 1 commit into from Feb 16, 2023

Conversation

KhafraDev
Copy link
Contributor

@KhafraDev KhafraDev commented Feb 15, 2023

hi

this allows for the following (only needed for typescript):

import { Transformer } from './index.js'

const width = 256
const height = 256
const uint8 = new Uint8Array(width * height * 4)
const transformer = Transformer.fromRgbaPixels(uint8, width, height)

this creates an empty 256x256 image. I use it to overlay multiple images without having to resize/stretch/overlap each other

Buffer is still allowed too, since it's a subclass of Uint8Array

const buffer = Buffer.alloc(width * height * 4) // slower
const transformer = Transformer.fromRgbaPixels(buffer, width, height)

it was possible before but I needed to cast Uint8Array to Buffer for typescript to be happy

@vercel
Copy link

vercel bot commented Feb 15, 2023

Someone is attempting to deploy a commit to a Personal Account owned by @Brooooooklyn on Vercel.

@Brooooooklyn first needs to authorize it.

@Brooooooklyn Brooooooklyn merged commit 0fa1f3c into Brooooooklyn:main Feb 16, 2023
@KhafraDev KhafraDev deleted the fromrgbapixels-uint8array branch February 16, 2023 14:43
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