• Bugs
  • [PhotoshopToSpine] Heavy image sizes

  • Изменено
Related Discussions
...

Hey guys, question about Photoshop to spine script,
When I use the script to generates the images, all images are very heavy and huge sizes !
If I use the "traditional" way ( export as png) the images are dramatically smaller with same quality !
of course this doesn`t matter because the final export is typical atlas png and smaller size.

However, I compared the exif - metadata images and I found too many lines (100+) in tag Document Anchestors, like the screenshot, I found what exactly is this, but my question is simpler.
Is that possible in future script update do not include this information ?

*sorry if this post is in the wrong place

Hello, could you send us a file that can reproduce the problem, and maybe also one of the exported files so we can look at the metadata to contact@esotericsoftware.com for reproduction purposes?

Thank you Erika, I already sent the mail with attachments.
Thank you again

We got the PNG files, thanks. You can see the savePNG function in the script:

function savePNG (file) {
   var options = new PNGSaveOptions();
   options.compression = 6;
   activeDocument.saveAs(file, options, true, Extension.LOWERCASE);
}

This is supposed to be roughly equal to "save as, PNG". That Photoshop adds a ton of XML is terrible, but it's a Photoshop problem with this kind of saving, so there's nothing we can do to avoid it.

We could do a different kind of saving. We used to actually, then we changed it to "save as" but I don't remember the reasons why. If you want to use "save for web" instead, change the function to this:

function savePNG (file) {
   var options = new ExportOptionsSaveForWeb();
   options.format = SaveDocumentType.PNG;
   options.PNG8 = false;
   options.transparency = true;
   options.interlaced = false;
   options.includeProfile = false;
   activeDocument.exportDocument(file, ExportType.SAVEFORWEB, options);
}

However, why is this important to fix? Spine reads your image files and ignores the Photoshop XML junk. When Spine packs a texture atlas, the PNGs it creates don't have such junk.

I suggest using Oxipng if you care about PNG file sizes. No software, even Spine, is going to write the smallest PNGs possible. We may integrate Oxipng in the future, so Spine exports can use it. See here:
Exported PNG file size too big using script


Actually looking in the script's Git history, it was "save as" since the first commit. I've updated to the script to use "save for web", let's see how that goes!

Thank you Nate for your reply !
Yes !
I changed the function as you suggested and works fine!
so, the reason for this changes is simple, because we are working remotely, all team share files vie server, and all those images are 10 times slower to upload, btw, now we are ok !

Thank you, for this solution !

2 года спустя

Hey everyone, I came across this thread because I had the same issue with big png exports. The proposed safe for web modification works but it exports files without extension for some reason so I have to add it manually.

I just changed the function savePNG with the one few posts above.

Did I miss something?

Thanks!

    We haven't seen the file not getting a PNG extensions. I'm not sure what is going on, or why only you'd see that.

    mister_z
    On exporting a spine I believe there is a text box where you are expected to input the file extension you want to use for the exported file. Perhaps you missed that, or accidentally cleared the extension from that box?

    • mister_z ответили на это сообщение.
    • Nate оценил это.
      20 дней спустя

      ExNull-Tyelor @Nate

      Hey everyone, I checked today, there is no box to write extension. 🙁

      You're right, there's no file extension box when running the Photoshop script. There is when exporting from Spine, but that's a different process.

      You could try modifying the savePNG function above like:

      activeDocument.exportDocument(file + ".png", ExportType.SAVEFORWEB, options);