🚨 rethumb will shutdown on September 4th, 2021 🚨 (Twitter)

<< More Tutorials

How to read Exif data in json format from an image in Kotlin using rethumb?

To read Exif data in json format from an image in Kotlin use the following code:

import java.io.BufferedReader
import java.io.InputStreamReader
import java.net.URL

object KotlinRethumbExifExample {

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

        val url = URL("http://api.rethumb.com/v1/exif/all/http://images.rethumb.com/image_exif_1.jpg")

        val reader = BufferedReader(InputStreamReader(url.openStream()))
        var s = reader.readLine()
        while (s != null) {
            println(s)
            s = reader.readLine()
        }

        // Use your favorite json library to parse the response!
    }
}

Start using this example now

Use the following commands to get started:

$ git clone https://github.com/rethumb/rethumb-kotlin-examples.git
$ cd rethumb-kotlin-examples
$ kotlinc read-exif-data-in-json.kt -include-runtime -d read-exif-data-in-json.jar
$ java -jar read-exif-data-in-json.jar

More examples using Kotlin