mirror of
https://github.com/gotson/komga.git
synced 2025-12-21 16:03:03 +01:00
parent
c4462d7f8b
commit
a6854753d2
2 changed files with 6 additions and 3 deletions
|
|
@ -71,7 +71,7 @@ dependencies {
|
|||
implementation("org.apache.pdfbox:pdfbox:2.0.17")
|
||||
implementation("net.grey-panther:natural-comparator:1.1")
|
||||
|
||||
implementation("org.imgscalr:imgscalr-lib:4.2")
|
||||
implementation("net.coobird:thumbnailator:0.4.8")
|
||||
implementation("com.twelvemonkeys.imageio:imageio-jpeg:3.4.2")
|
||||
implementation("com.twelvemonkeys.imageio:imageio-tiff:3.4.2")
|
||||
implementation(files("$projectDir/libs/webp-imageio-decoder-plugin-0.2.jar"))
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package org.gotson.komga.infrastructure.image
|
||||
|
||||
import mu.KotlinLogging
|
||||
import org.imgscalr.Scalr
|
||||
import net.coobird.thumbnailator.Thumbnails
|
||||
import org.springframework.stereotype.Service
|
||||
import java.io.ByteArrayOutputStream
|
||||
import javax.imageio.ImageIO
|
||||
|
|
@ -32,7 +32,10 @@ class ImageConverter {
|
|||
|
||||
fun resizeImage(imageBytes: ByteArray, format: String, size: Int): ByteArray =
|
||||
ByteArrayOutputStream().use {
|
||||
ImageIO.write(Scalr.resize(ImageIO.read(imageBytes.inputStream()), Scalr.Method.AUTOMATIC, size), format, it)
|
||||
Thumbnails.of(imageBytes.inputStream())
|
||||
.size(size, size)
|
||||
.outputFormat(format)
|
||||
.toOutputStream(it)
|
||||
it.toByteArray()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue