Using an Aseprite Importer for Godot, and I’m wondering if it’s possible to get the document pixel ratio from the .aseprite file?
I’m the guy providing the aforementioned importer plugin
I am wondering if it’s actually possible, I can’t find no docs to force this option. Any clue?
I don’t see anything for getting or setting pixel aspect from CLI, but it is in the Lua scripting API. The CLI documentation includes an option to run Aseprite with a Lua script.
For GDScript in Godot, the file format specification for .aseprite could guide you through parsing the file. (I don’t use Godot all that much, so there may be a better way. I just looked at the docs for FileAccess.)
var file_path = "path\\to\\file.asesprite"
var file = FileAccess.open(file_path, FileAccess.READ)
if file == null:
print("Error opening file.")
return
var file_size = file.get_32()
var signature = file.get_16()
var frame_count = file.get_16()
var sprite_width = file.get_16()
var sprite_height = file.get_16()
var color_depth = file.get_16()
var flags = file.get_32()
var speed = file.get_16()
var reserved = file.get_64()
var alpha_index = file.get_8()
var padding_0 = file.get_8()
var padding_1 = file.get_16()
var num_colors = file.get_16()
var x_pixel_aspect = file.get_8()
var y_pixel_aspect = file.get_8()
print("file_size: 0x%08X" % file_size)
print("signature: 0x%04X" % signature)
print("frame_count: 0x%04X" % frame_count)
print("sprite_width: 0x%04X" % sprite_width)
print("sprite_height: 0x%04X" % sprite_height)
print("x_pixel_aspect: 0x%02X" % x_pixel_aspect)
print("y_pixel_aspect: 0x%02X" % y_pixel_aspect)