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 for slicing images before exporting. #30

Open
TricksterGuy opened this issue Dec 10, 2018 · 3 comments
Open

Support for slicing images before exporting. #30

TricksterGuy opened this issue Dec 10, 2018 · 3 comments

Comments

@TricksterGuy
Copy link
Owner

Use case: The user has an image whose dimensions won't fit a valid export option and would prefer not to split it into many bitmaps.

Possible syntax

Assuming image1.png is a 96x96 image

nin10kit --mode=sprites --bpp=X image1.png[0,0,64x64] image1.png[64,0,32x64] image1.png[0,64,64x32] image1.png[64,64,32x32]

Would chop image1.png and export the top left as a 64x64, top right as a 32x64 and bottom left as a 64x32 and bottom right as a 32x32

@HorstBaerbel
Copy link

Very flexible, but seems a bit verbose. I would be just fine with the "--autotile" option.

@TricksterGuy
Copy link
Owner Author

That is true. The issue I have with auto tiling is what behavior would one expect. Optimally images would have dimensions < 64 or a multiple of 64.

But for instance if someone passed an image that's say 104x104, would you expect the behaviour to split the image into 4 64x64 tiles (with appropriate padding) or split it in such a way to minimize the number of tiles used.

In the first case 4 objects are needed to display it, but its a waste of 87 tiles because of the padding. In the second you'd need 11 objects, but no padding required so no waste of tiles.

Well I guess if I do this. Why not support both approaches, loose and exact autotiling

@HorstBaerbel
Copy link

I see the problem, so it might make sense to support both. Your example is sort of a worst case. This is a optimization problem, that's why I said it's not easy. If you're up for it, a "minimize-tiles=x" parameter could control the autotiling behaviour. If you pass that, nin10kit tries to pad depending on a metric factoring in x, the number of tiles saved vs. the tiles wasted.

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