Free Trial
10 days, no credit_card

<< More Tutorials

How to resize an image by width and height in Kotlin using rethumb?

To resize an image or photo in Kotlin use the following code:

import java.nio.channels.Channels

object KotlinRethumbWidthHeightExample {

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

        val paramOperation1 = "height"
        val paramValue1 = 100 // New height in pixels.

        val paramOperation2 = "width"
        val paramValue2 = 100 // New width in pixels.

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

        val url = URL(String.format("", paramOperation1, paramValue1, paramOperation2, paramValue2, 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-by-width-and-height.kt -include-runtime -d resize-by-width-and-height.jar
$ java -jar resize-by-width-and-height.jar

More examples using Kotlin