aseprite / aseprite

Animated sprite editor & pixel art tool (Windows, macOS, Linux)
https://www.aseprite.org
29.54k stars 6.22k forks source link

[File Format] Questions. #2114

Open cyraid opened 5 years ago

cyraid commented 5 years ago

Hi @dacap, just had some questions on the File Format. I commented here https://github.com/aseprite/aseprite/issues/1538 about the importer I made, however..

Layers: Currently layers can arrive at any chunk, which when trying to remap is pretty inconvenient, would there be possibility for a "Layers Chunk" that would have all layers in one chunk?

Zlib: Since the importer is C#, and it only supports gzip and deflate (not zlib), I had to bloat it with another library just for 2 bytes header (and an adler32 crc footer).. I'm not a fan of dirty solutions so I didn't want to just skip the 2 bytes. Will it be guaranteed to always be mode 8 of zlib with no dictionary? If so, could you mark it in the spec, then I could just skip the 2 bytes safely? Or maybe in the future the format could use gzip or zip? (as they're more common).

Thank you. ^_^

dacap commented 5 years ago

Hi @cyraid! About layers, I think all layers chunks should be in the first frame (after the frame header => color profile chunk + palette chunk + color2 chunk => all layer chunks). I'm not sure that more chunks can appear after that (at least I'm not aware of that from Aseprite code, but I might be wrong).

About zlib, there are no plans to change the cel type = 2 (Compressed Image), but it's probable that in the future I add a new cel type (e.g. cel type = 3 with a simple RLE compression).

I should give a try to other formats too (.zip files) #183

cyraid commented 5 years ago

Thanks for replying @dacap! Yeah it stated in the file format doc all layers are in the first frame, but it feels so dirty lol .. I always think of future proofing, and since it's chunk based and technically if someone made a aseprite writer, and were to miss that one detail and someone else were to write their writer assuming they all came in the first frame and errornously loaded them all first.. I written my loader to dynamically handle them as they appear but, it was just a minor little thing.. Shouldn't be too hard for the average programmer anyway. :)

And yes! Having support for zip format would open the door to more common implementations in the future. I thought about it for a bit, and unless you deprecate cel type 2, people will still want to make a loader that loads all anyway.. So adding RLE compression might work for their projects, but at this point it might just be easier/better to add a .zip format.

The bonuses of a .zip format would be that you can make it a 'project' style format. You could hold many sub-sprites in there, and possibly a common palette that is shared amongst them.

Two ways that just come to me that you could do a project file style file format that would include sub sprites.. The first would be bundling all files in one single file, and a shared palette (optional).. The second would be like a "visual studio solution" kinda file, where it's just information about where the shared palette is, and where the other .ase files are.. Though the second idea wouldn't allow people to bundle the assets together.

Another quick idea would be to have a whole sub-document as a chunk type lol! That'd be kinda messy though.

johanwendin commented 5 years ago

If you do change how the file format works, please consider ways to let the users save using older formats. There are tools out there which rely on the .ase files working the way they currently do. (i.e. if you change to another type of compression, please let it be a setting somewhere)