• EditorBugs
  • Photoshop to Spine script fails to 'Trim Whitespace' on all layers

Problem statement:

Not strictly editor related but I couldn't find any tag for bugs related to the export scripts specifically: The Export script found at EsotericSoftware/spine-scriptstree/master/photoshop for exporting PSDs to Spine frames is not functioning correctly for me.

Describe: 1) what you have tried, 2) what you expected, and 3) what actually happened.

As pictured, here are my export settings. "Trim Whitespace" is clearly togged ON. However the resulting export does not trim whitespace for all images.


Pictured: Whitespace around every exported image.
I have tried exporting with and without 'Trim Whitespace' selected. There is no difference in the result in either case.
Expected: The white space around each layer to be trimmed so that each image is completely flush with its bounds for ease of sprite packing.
Actual: Whitespace is not trimmed.

Give step-by-step instructions so we can reproduce the problem, if possible.

  1. Place the export script in your Photoshop scripts folder as the instructions instruct found in the github link.
  2. Run it on the attached PSD with 'Trim Whitespace' selected.
  3. See that some images don't get their whitespace trimmed.

Editor information

Tell us your Spine Editor version.
Photoshop 23.2.0 using the Export script found at EsotericSoftware/spine-scriptstree/master/photoshop

Related Discussions
...

The issue you're experiencing with the Photoshop to Spine script not trimming whitespace correctly is known and has been discussed in the forums. It appears that the problem occurs when the "Trim whitespace" option is enabled in the PhotoshopToSpine settings. A workaround is to disable "Trim whitespace" in the PhotoshopToSpine script and then enable "Strip whitespace X/Y" in the texture packer settings when you pack the texture in Spine. This should help trim the whitespace during the packing process.

Here are the steps to follow:

  1. Disable "Trim whitespace" in the PhotoshopToSpine script settings.
  2. Export your images.
  3. In Spine, enable "Strip whitespace X/Y" in the texture packer settings when packing the texture.

This workaround should help you achieve the desired result of having images without unnecessary whitespace.

For more details, you can refer to the issue ticket created for this problem: Issue #737.

  • madmuffin ответили на это сообщение.

    Spinebot

    This workaround is not very great because then all my images have huge whitespace in the scene working with them. I was hoping for a fix to the script but it sounds like you're implying no such fix exists nor will ever exist :/

    I just tested it out with the new PSD import and it works just fine! please switch to that, it's also faster!
    https://esotericsoftware.com/spine-import-psd/

    madmuffin I checked your PSD and it seems that there are simply pixels that appear to be blank but actually have color. I selected the main image portion of the layer that would have large blank areas after export, inverted it, hit the delete key to clean up the selected pixels, and then ran PhotoshopToSpine again and no additional blank areas were created.

    In the case of your PSD, it appears that there are some pixels with color in somewhere around the four edges, so if you select pixels around the four edges and remove the pixel, it should work.