Free Trial
10 days, no credit_card

<< More Tutorials

How to resize an image to cover any dimensions in Kotlin using rethumb?

To resize an image, with our "cover" operation, in Kotlin use the following code:

import java.nio.channels.Channels

object KotlinRethumbCoverExample {

    @JvmStatic fun main(args: Array<String>) {

        val paramOperation = "cover"
        val paramValue = "150x200" // New WIDTHxHEIGHT 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 cover.kt -include-runtime -d cover.jar
$ java -jar cover.jar

More examples using Kotlin