jhuckaby / lbmtool

Converts DeluxePaint LBMs to JSON or PNG format.
Other
4 stars 2 forks source link

Client-side version? #1

Open iangilman opened 7 months ago

iangilman commented 7 months ago

What do you suppose it would take to make a version of this that would run entirely on the client-side? It's fine if it depends on other stuff.

jhuckaby commented 7 months ago

You want something that reads LBM files on the client-side? What on earth are you working on, Ian? Who even makes LBM files anymore? 😝

Well, if you remove all the PNG output code (which also eliminates the gzip/zlib dependency), and just go with JSON output, then I think it would be fairly straightforward.

In fact, check out browserify: https://browserify.org/

I've used this before for my canvas-plus library. It allows you to pretty instantly and magically just "run" node modules in the browser with little-to-no changes. It mocks / polyfills things like fs and Buffer for you.

iangilman commented 7 months ago

😂 Excellent questions! I believe (hope?) ProMotion can export LBM files. I'm also looking at what's involved in converting ProMotion files directly:

https://community.cosmigo.com/t/reading-pmp-files-in-javascript/1474

You don't happen to have an FLC reader laying around, do you? 😉

For starters I'm just using your LBM tool server-side, which works great, but it might be nice to be able to do it all on the client. Thank you for the guidance on how to do that!

jhuckaby commented 7 months ago

Ah, I see what you're up to now. Very cool!

This is the first time I've encountered FLIC, but it looks fairly straightforward. I asked ChatGPT 4, and it started the conversion, and had a few helpful tips, but it couldn't do the full job, alas:

https://chat.openai.com/share/5ded2c5e-b4cf-47ba-af67-922f6e72dd02

Another idea would be to use WASM, which is becoming really popular. Using that you can basically run native C/C++ code right in the browser, by compiling it to WASM using Emscripten. Then you can just call it from JavaScript and get back a result.

For example, Squoosh is all WASM, but runs in the browser: https://squoosh.app/

Source code is here: https://github.com/GoogleChromeLabs/squoosh

Anyway, sounds like a fun project!

iangilman commented 6 months ago

Awesome… Thank you for the leads!

At the moment I am exploring all the possibilities. We'll see where I end up.

On the LBM front, I've just met the author of this library: https://git.michaelsmith.be/m/pbm-js

It's fun to see how many people are interested in this stuff!