Parsing webp file header in Kotlin to get its height and width, but getting unexpected results
问题 I am trying to read the WebP image header, according to the WebP Container Specification of Extended File Format. fun get24bit(data: ByteArray, index: Int): Int { return ((data[0 + index].toInt()) or (data[1 + index].toInt() shl 8) or (data[2 + index].toInt() shl 16)) } fun get32bit(data: ByteArray, index: Int): Int { return get24bit(data, index) or (data[3 + index].toInt() shl 24) } // data -> File(fileName).readBytes() for testing purpose fun webpExtract(data: ByteArray) { println(String