diff --git a/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/utils/EtherealGambiConfig.kt b/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/utils/EtherealGambiConfig.kt index 56bec26..b20b40f 100644 --- a/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/utils/EtherealGambiConfig.kt +++ b/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/utils/EtherealGambiConfig.kt @@ -11,4 +11,10 @@ data class EtherealGambiConfig( val name: String, val token: String ) + + @Serializable + data class OptimizationSettings( + val path: String, + val useOptiPNG: Boolean + ) } \ No newline at end of file diff --git a/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/utils/GIFImageInfo.kt b/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/utils/GIFImageInfo.kt index 727b430..649cbac 100644 --- a/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/utils/GIFImageInfo.kt +++ b/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/utils/GIFImageInfo.kt @@ -41,9 +41,7 @@ class GIFImageInfo( generatedImageFile.writeBytes(originalImageFile.readBytes()) - // We don't care about the results - if (variant.imageType != ImageType.GIF) - m.pngQuant.optimize(generatedImageFile) + // TODO: Use gifsicle to optimize the GIF! data.variants.add( ImageVariantInfoData( diff --git a/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/utils/PNGImageInfo.kt b/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/utils/PNGImageInfo.kt index fd4f302..bc15807 100644 --- a/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/utils/PNGImageInfo.kt +++ b/backend/src/main/kotlin/net/perfectdreams/etherealgambi/backend/utils/PNGImageInfo.kt @@ -44,8 +44,7 @@ class PNGImageInfo( generatedImageFile.writeBytes(originalImageFile.readBytes()) // We don't care about the results - if (variant.imageType != ImageType.GIF) - m.pngQuant.optimize(generatedImageFile) + m.pngQuant.optimize(generatedImageFile) data.variants.add( ImageVariantInfoData( @@ -85,11 +84,7 @@ class PNGImageInfo( ImageIO.write( x, - when (variant.imageType) { - ImageType.PNG -> "png" - ImageType.GIF -> "gif" - // ImageType.JPEG -> "jpeg" - }, + "png", generatedImageFile ) @@ -104,15 +99,6 @@ class PNGImageInfo( ) ) - data.variants.add( - ImageVariantInfoData( - EtherealGambi.OPTIMIZATION_VERSION, - pathWithVariant, - variant, - generatedImageFile.length() - ) - ) - return@withLock generatedImageFile } }