Created
October 7, 2020 16:13
-
-
Save DineshSolanki/085b519ae1ac23ea54b4068814855339 to your computer and use it in GitHub Desktop.
Kotlin BufferedImage extension function to transpose image.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun BufferedImage.getTransposed(): BufferedImage { | |
val transposeImage = BufferedImage(this.height, this.width, BufferedImage.TYPE_INT_RGB) | |
repeat(transposeImage.width) { w -> | |
repeat(transposeImage.height) { h -> | |
transposeImage.setRGB(w, h, this.getRGB(h, w)) | |
} | |
} | |
return transposeImage | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment