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

Support load jpg in basis encoder #352

Closed
wants to merge 2 commits into from

Conversation

gz65555
Copy link

@gz65555 gz65555 commented Jul 7, 2023

Fix #351

This pull request adds support for loading JPEG images in the WebAssembly version of the basis_universal library. Previously, only PNG images were supported in the wasm version.

To use the new feature, users can specify the type of source image by passing a number to the basis_universal library, where 1 represents a PNG image and 2 represents a JPEG image.

Here's an example code snippet that shows how to use the new setSliceSourceImage function with a JPEG image:

// 1 represent png file, 2 for jpg, 0 for raw image data
var type = 1; 
basisEncoder.setSliceSourceImage(0, new Uint8Array(data), 0, 0, type);

@gz65555
Copy link
Author

gz65555 commented Jan 10, 2024

Use createImageBitmap to create ImageSource, no need to support jpg.

@gz65555 gz65555 closed this Jan 10, 2024
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.

Webssembly version does not support jpg format
1 participant