benkuly
05/04/2022, 5:21 AMUnsupportedOperationException: No suitable image format : MAGIC:ノPNG(89504e47) (ノPNG)
when running this code in nodeJs. It works on JVM and js/browser:
suspend fun createThumbnail(file: ByteArray, maxWidth: Int, maxHeight: Int): Thumbnail {
val image = file.asMemoryVfsFile().readNativeImage() <-- I think the exception throws here.
val resizedImage = image.resizedUpTo(maxWidth, maxHeight)
return Thumbnail(resizedImage.encode(PNG), ContentType.Image.PNG, resizedImage.width, resizedImage.height)
}
Any idea? Maybe I'm using the API wrong.benkuly
05/09/2022, 8:59 AM