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

Async Usage #6

Closed
the-simian opened this issue Aug 9, 2019 · 7 comments
Closed

Async Usage #6

the-simian opened this issue Aug 9, 2019 · 7 comments

Comments

@the-simian
Copy link

Hey I am currently using this in a code-first manner (not on the command line). I was interested in doing some image-compression as a post process, but I'm not 100% sure if this can be used in an async way at the moment. I was wondering if it might be possible to either add imagemin (and args) or make this async so another person can do it

Thanks for this great utility!

@the-simian
Copy link
Author

another thing is I am also not against, adding a PR for this, but I wanted to open an issue and pick your brain first.

I am using this in my project here:
https://github.com/simiancraft/create-phaser-app/tree/master/level-processor
if you want some idea of how its' being used.

I am about to make some updates where there is image compression in the processed output folders by default, basically. I also read through the code and I see how you're using the jimp lib to achieve results, so I am not opposed to writing something if I need to if you're not interested in changing this lib in this way, which I totally understand.

@mikewesthad
Copy link
Member

Hey @the-simian - thanks for reporting the issue. I was traveling, but will look into it this week. Looks like that link might be broken?

@mikewesthad
Copy link
Member

Yikes, the library was mostly asynchronous, but it wasn't exposed as such. I didn't expect people would want to use it as a library - whoops! The latest commits on the master branch should remedy that, returning a promise that resolves/rejects when the extrusion is done/errored (released as v1.2.0).

So, if I understand correctly, you want to be able to hook into when the tile extrusion is done (so that you can minify the final image)? I don't think it makes sense to integrate imagemin directly into tile extruder itself, but we could expose a function that returns a buffer (instead of saving to disk) so that anyone could pipe that buffer into imagemin, or whatever image manipulation library. The readme could even include a code snippet example of how to use tile extruder with imagemin. How's that sound?

@the-simian
Copy link
Author

@mikewesthad I think that sounds sensible! Thank you for looking at 'how' I am using this so you can contextualize it. I'm basically using it as a processor to prepare things built in Tiled to be consumed in Phaser.js, and this is a really useful step, because without doing this you'd have to go do it all by hand.

Thank you again for looking into how I am using this. I appreciate this little tool. I gave some talks about the necessity of tile extrusion at my usergroup and at a local conference, and I mentioned this tool.

I know its a bit offtopic, but since I had your attention, I figured you'd get a kick out of seeing these:
OKCJS last year: https://www.youtube.com/watch?v=lDNmu_9J2p8
Thunderplains: https://www.youtube.com/watch?v=ZcceLV_5yXY

I mention this very tile extruder in both talks. I think its a super useful tool!

@mikewesthad
Copy link
Member

mikewesthad commented Aug 16, 2019

No problem. Having a build pipeline like that which just handles all this under the hood sounds wonderful. I just published a new release today. It should make it easier to integrate. There's an imagemin code snippet in the readme, as well as API docs online now.

Glad you've found the extruder helpful. Thanks for sharing the talks. I definitely learned a few new tricks. I'll be keeping an eye on create-phaser-app.

@the-simian
Copy link
Author

@mikewesthad thank you again, I'll update my project with the latest version, this is great!

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

No branches or pull requests

2 participants