chinedufn / psd

A Rust API for parsing and working with PSD files.
https://chinedufn.github.io/psd
Apache License 2.0
265 stars 40 forks source link

[feature] Add support for slices v7 and v8 #36

Closed scoiatael closed 2 years ago

scoiatael commented 2 years ago

Hey,

Looks like newer (Adobe Photoshop CS and later) format for slices is not supported - https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_19931

This PR adds that support :)

TODO:

chinedufn commented 2 years ago

Looks great thanks for putting this together!

Can merge as soon as we replace that big PSD fixture with a small one.

scoiatael commented 2 years ago

Managed to simplify the file down to 1MB - I honestly don't know why it's that much - it's essentially empty file. But looks like tests pass so we should be good to go :)

chinedufn commented 2 years ago

Thanks for putting this together!

Right now it looks like our biggest PSD test fixture is under 25KB.

I don't have access to Photoshop at the moment to try to make a smaller one... Are you making this using Photoshop or some other program? Is your file small (i.e. less than 9x9) or is it larger?

Hopefully we can get this to a more reasonable size. Having one file that's 1Mb won't be too terrible I suppose.. just trying to see if we can avoid opening up our doors for big files..

Or is it fundamentally impossible to shrink this fixture any further for some reason?

Thanks!

scoiatael commented 2 years ago

Hm. I used Photoshop to avoid artificially creating something that you won't stumble upon in the wild :) The problem is that I'm not that proficient in PS to really know what is represented by this slice - essentially I was removing parts of design as long as the this library was complaining about slice version not being supported. And there ain't much left.

Sadly I'm running out of time allocated for work here. We can simply wait with this PR until you have access to PS. Or we could use Git LFS for fixtures? Looks like Github allocates 1GB per account: https://docs.github.com/en/billing/managing-billing-for-git-large-file-storage/about-billing-for-git-large-file-storage

chinedufn commented 2 years ago

Awesome, yeah we've used Photoshop for all of the other fixtures.

I'll get access to Photoshop and mess around with this.

Since our fixtures don't ever change a 1MB file isn't too bad.. so if I can't get it smaller I'll land this.

Thanks!

chinedufn commented 2 years ago

Hey before I mess with Photoshop, can you confirm that you tried resizing the PSD file to 1x1? Thanks!

scoiatael commented 2 years ago

Hey, sorry for not answering for a long time - managed to learn a couple of tricks in PS and now the size is 24K :)

chinedufn commented 2 years ago

Awesome!!!

chinedufn commented 2 years ago

Published to crates.io as 0.3.4