896 to 898 is correct. Wait, you want to not export layers that are divisible by 16? I missed that requirement. Try:
var increaseX = (width - settings.padding * 2) % 16;
if (increaseX > 0) width += (16 - increaseX) / scale;
increaseY = (height - settings.padding * 2) % 16;
if (increaseY > 0) height += (16 - increaseY) / scale;
// Save image.
if (writeImages && (increaseX || increaseY)) {
That will skip create the image. I guess that's what you mean by ignore? It'll still be in the skeleton data as an attachment.
I didn't try the PSD because it seems like the problem was in defining the requirements rather than the code. Hopefully the above is enough. π