sprite-sheet-packer
sprite-sheet-packer copied to clipboard
Infinite loop on small images
Mac user here. It seems that when I use images smaller than 10px (10px width, 9px height, png), the application hangs and seems to go in an infinite loop. It says: Optimizing atlas in the bottom right corner. I have to force quit it to stop it. When I use an image of 10x10px, it's fine. I searched in the source code, but I am having a hard time to find out why it does that. There is a for and while loop after that statement that displays the message:
bool SpriteAtlas::packWithRect(const QVector<PackContent>& content) {
Hi, please send me examples of files which cause this mistake, and the file of the project with settings
json of the project file:
{
"algorithm": "Rect",
"dataFormat": "pixijs",
"destPath": "../../assets",
"encryptionKey": "",
"epsilon": 15,
"heuristicMask": false,
"imageFormat": "*.png",
"jpgQuality": 80,
"pixelFormat": "ARGB8888",
"pngOptLevel": 7,
"pngOptMode": "None",
"premultiplied": true,
"prependSmartFolderName": true,
"rotateSprites": false,
"scalingVariants": [
{
"forceSquared": false,
"maxTextureSize": 2048,
"name": "",
"pow2": false,
"scale": 1
}
],
"spriteBorder": 0,
"spriteSheetName": "spritesheet",
"srcList": [
],
"textureBorder": 0,
"trimMode": "Rect",
"trimSpriteNames": true,
"trimThreshold": 0,
"webpQuality": 80
}
I used this sprites:
and sprite sheet worked correctly
did you also try the sprite I provided?
i found mistake int step = (w + h) / 20;
incorrect calculate steps try fix this: int step = max( (w + h) / 20, 1);
ah, so It would resolve to 0, hanging somewhere without doing any steps?
yes, see last commit Thanks for the help :)
Nice. Btw, the latest release is from 2017, will you create a new release soon?
Oh I did not do it so long ago:)
37 commits behind master ;)
crashed when i choose a smaller size of the sprite sheet