Is there currently a problem with the Skija Image ...
# compose-desktop
c
Is there currently a problem with the Skija Image Converter? I tried to show PNG images, given as ByteArray. Whenever I save that ByteArray into a file, everything works and the given code also worked some months ago with an older version of compose: Everytime I run the code
Copy code
@Composable
fun ByteArrayImage(
    image: ByteArray,
    contentScale: ContentScale = ContentScale.Fit,
    modifier: Modifier = Modifier
) {
    val bitmap by derivedStateOf { SkiaImage.makeFromEncoded(image).toComposeImageBitmap() }
    Image(
        bitmap = bitmap,
        contentDescription = null,
        contentScale = contentScale,
        modifier = modifier.fillMaxSize()
    )
}
It results in
Copy code
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Failed to Image::makeFromEncoded
	at org.jetbrains.skia.Image$Companion.makeFromEncoded(Image.kt:139)
	at de.babsek.condocs.desktop.composelib.ByteArrayImageKt$ByteArrayImage$bitmap$2.invoke(ByteArrayImage.kt:19)
	at de.babsek.condocs.desktop.composelib.ByteArrayImageKt$ByteArrayImage$bitmap$2.invoke(ByteArrayImage.kt:19)
	at androidx.compose.runtime.snapshots.Snapshot$Companion.observe(Snapshot.kt:1798)
	at androidx.compose.runtime.DerivedSnapshotState.currentRecord(DerivedState.kt:117)
	at androidx.compose.runtime.DerivedSnapshotState.getDependencies(DerivedState.kt:172)
	at androidx.compose.runtime.CompositionImpl.recordReadOf(Composition.kt:587)
	at androidx.compose.runtime.Recomposer$readObserverOf$1.invoke(Recomposer.kt:792)
	at androidx.compose.runtime.Recomposer$readObserverOf$1.invoke(Recomposer.kt:792)
	at androidx.compose.runtime.DerivedSnapshotState.getValue(DerivedState.kt:160)
Any ideas? Thank you very much in advance 🙂
k
Skija is no longer under active development. Skiko is its replacement.
c
Oh, thank you. Do you know if there is an equivalent replacement for this functionality?
c
Even with using Skiko (which provides the Skia library) by adding it into the build.gradle, the same error comes again. Does anyone have any more ideas?
k
File a bug
126 Views