Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix PNG image compression PNG image compression (#268)
- Loading branch information
Showing
5 changed files
with
84 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
scrimage-tests/src/test/kotlin/com/sksamuel/scrimage/core/Issue267Test.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.sksamuel.scrimage.core | ||
|
||
import com.sksamuel.scrimage.ImmutableImage | ||
import com.sksamuel.scrimage.nio.PngWriter | ||
import io.kotest.core.spec.style.FunSpec | ||
import io.kotest.matchers.ints.shouldBeLessThan | ||
import java.awt.image.BufferedImage | ||
|
||
class Issue267Test : FunSpec() { | ||
init { | ||
test("png compression for all types") { | ||
val originalImage = ImmutableImage.loader().fromResource("/issue267.png") | ||
originalImage.copy(BufferedImage.TYPE_4BYTE_ABGR).bytes(PngWriter.MaxCompression).size shouldBeLessThan 15000 | ||
originalImage.copy(BufferedImage.TYPE_3BYTE_BGR).bytes(PngWriter.MaxCompression).size shouldBeLessThan 15000 | ||
originalImage.copy(BufferedImage.TYPE_INT_ARGB).bytes(PngWriter.MaxCompression).size shouldBeLessThan 15000 | ||
originalImage.copy(BufferedImage.TYPE_INT_BGR).bytes(PngWriter.MaxCompression).size shouldBeLessThan 15000 | ||
originalImage.copy(BufferedImage.TYPE_INT_RGB).bytes(PngWriter.MaxCompression).size shouldBeLessThan 15000 | ||
} | ||
} | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.