Skip to content

Commit

Permalink
Smol refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPowerGamerBR committed Oct 14, 2024
1 parent 9401900 commit 989c1f8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ data class EtherealGambiConfig(
val name: String,
val token: String
)

@Serializable
data class OptimizationSettings(
val path: String,
val useOptiPNG: Boolean
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -85,11 +84,7 @@ class PNGImageInfo(

ImageIO.write(
x,
when (variant.imageType) {
ImageType.PNG -> "png"
ImageType.GIF -> "gif"
// ImageType.JPEG -> "jpeg"
},
"png",
generatedImageFile
)

Expand All @@ -104,15 +99,6 @@ class PNGImageInfo(
)
)

data.variants.add(
ImageVariantInfoData(
EtherealGambi.OPTIMIZATION_VERSION,
pathWithVariant,
variant,
generatedImageFile.length()
)
)

return@withLock generatedImageFile
}
}
Expand Down

0 comments on commit 989c1f8

Please sign in to comment.