Skip to content

Conversation

alexchuber
Copy link
Contributor

@alexchuber alexchuber commented Oct 15, 2025

This PR introduces the NativeEncoding plugin, which provides native image encoding capabilities to JavaScript. Raw pixel data can be encoded into standard image formats (PNG, JPEG, WebP, etc.), serving Babylon.js's needs for texture export.
See the README for more info.

As this PR is focused on the plugin (and some smoke tests for it), the following will be delegated to future PRs:

  • Adding example use cases to the Playground
  • Adding example use cases to the visual test suite
  • Using the plugin from TestUtils

@alexchuber alexchuber marked this pull request as ready for review October 16, 2025 02:11
@alexchuber alexchuber marked this pull request as draft October 16, 2025 03:17
@CedricGuillemet
Copy link
Contributor

TestUtils plugin has a basic png writer (

void TestUtils::WritePNG(const Napi::CallbackInfo& info)

) that should be replaced by this PR change. It's being used by https://github.com/BabylonJS/BabylonNative/blob/master/Apps/Playground/Scripts/validation_native.js

@alexchuber
Copy link
Contributor Author

TestUtils plugin has a basic png writer that should be replaced by this PR change.

Totally. Will do this in a follow-up PR.

})
.then(*runtimeScheduler, arcana::cancellation_source::none(),
[runtimeScheduler, deferred, env](const arcana::expected<std::vector<uint8_t>, std::exception_ptr>& result) {
// TODO: Crash risk on JS teardown - this async work isn't tied to any JS object lifetime,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

See issue #1558

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.

4 participants