Fix "Image height is zero" error when secondary tileset has zero unique tiles #72
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The easiest way to trigger this is to create a secondary tileset using the same top/middle/bottom images for both the primary and secondary tileset. Since the primary and secondary all use the same tiles, the secondary will have zero unique tiles.
Formerly, when porytiles would write a image representing zero tiles, porytiles would attempt to write a zero-height image, with an emphasis on "not read a zero-height image", which libpng would call out as an error and would cause compilation to fail.
With this change, the output image for a tileset with zero tiles will be padded with transparent tiles, to create an output image with a non-zero height that libpng will be willing to write.