korlibs / korlibs/korge

How to get all layers in a aseprite file?

Open
#1,193 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
3k
Forks
148
Avg merge
13h 44m
Merged PRs (30d)
1

Description

Here's my aseprite:

image

There doesn't seem to be a way to get all layers in the file. When reading I only get the base layer:

image

```
val asp = resourcesVfs["tower_sprites.aseprite"].readImageDataContainer(ASE.toProps())

println(asp)
println(asp.imageDatas)
println(asp.imageDatasByName)

println(asp.imageDatas.first())
println(asp.imageDatas.first().frames.first())

image(asp.imageDatas.first().frames.first().bitmap) {
scaleWhileMaintainingAspect(ScalingOption.ByWidthAndHeight(300.0, 300.0))
}

```

Output of println statements:

```
com.soywiz.korim.format.ImageDataContainer@5404e08b
[ImageData([ImageFrame(BitmapSlice(null:SizeInt(width=32, height=32)), time=100ms, targetX=0, targetY=0, main=false)])]
{null=ImageData([ImageFrame(BitmapSlice(null:SizeInt(width=32, height=32)), time=100ms, targetX=0, targetY=0, main=false)])}
ImageData([ImageFrame(BitmapSlice(null:SizeInt(width=32, height=32)), time=100ms, targetX=0, targetY=0, main=false)])
ImageFrame(BitmapSlice(null:SizeInt(width=32, height=32)), time=100ms, targetX=0, targetY=0, main=false)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the resourcesVfs["tower_sprites.aseprite"].readImageDataContainer(ASE.toProps()) call and inspect how its imageDatas and imageDatasByName results represent the file. Verify whether the Aseprite layers are being discarded during loading; done means all layers can be accessed from the returned container, with behavior covered by an appropriate test.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
computer-graphics, game-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.