Running JDeli in Scala
Table of contents
Introduction
The following tutorial shows you how to use JDeli in Scala.
Prerequisites
Code Example
This code snippet uses JPG to PNG conversion as an example. This example uses sbt as the build tool.
build.sbt
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / scalaVersion := "3.3.6"
lazy val root = (project in file("."))
.settings(
name := "jdeli-scala"
)
Main.scala
import com.idrsolutions.image.JDeli
import java.awt.image.BufferedImage
import java.io.File
object Main {
def main(args: Array[String]): Unit = {
val inputFile = new File("jpgFile.jpg")
val outputFile = new File("pngFile.png")
val bufferedImage: BufferedImage = JDeli.read(inputFile)
JDeli.write(bufferedImage, "png", outputFile)
}
}