Free Trial
10 days, no credit_card

<< More Tutorials

How to create a square thumbnail from an image in Kotlin using rethumb?

To create a square thumbnail in Kotlin use the following code:

import java.nio.channels.Channels

object KotlinRethumbSquareExample {

    @JvmStatic fun main(args: Array<String>) {
        val paramOperation = "square"
        val paramValue = 100 // Square size in pixels.

        val imageURL = ""
        val imageFilename = "resized-image.jpg"

        val url = URL(String.format("", paramOperation, paramValue, imageURL))
        val fos = FileOutputStream(imageFilename), 0, java.lang.Long.MAX_VALUE)

Start using this example now

Use the following commands to get started:

$ git clone
$ cd rethumb-kotlin-examples
$ kotlinc resize-to-square.kt -include-runtime -d resize-to-square.jar
$ java -jar resize-to-square.jar

More examples using Kotlin