Skip to content

Commit

Permalink
Change JPEG quality to 90
Browse files Browse the repository at this point in the history
  • Loading branch information
zbx1425 committed Jan 8, 2025
1 parent 70dd086 commit 89232b7
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static byte[] toJpeg(byte[] pngImageBytes) {
}
try {
try (ByteArrayWriteCallback writeCallback = new ByteArrayWriteCallback(pngImageBytes.length)) {
if (STBImageWrite.stbi_write_jpg_to_func(writeCallback, 0, width.get(0), height.get(0), 4, pixels, 100) == 0) {
if (STBImageWrite.stbi_write_jpg_to_func(writeCallback, 0, width.get(0), height.get(0), 4, pixels, 90) == 0) {
throw new IllegalStateException("Failed to write JPEG image: " + STBImage.stbi_failure_reason());
}
return writeCallback.array();
Expand Down Expand Up @@ -92,7 +92,7 @@ public static byte[] toJpegScaled(byte[] pngImageBytes, int maxWidth) {
throw new IllegalStateException("Failed to resize image: " + STBImage.stbi_failure_reason());
}
try (ByteArrayWriteCallback writeCallback = new ByteArrayWriteCallback(pngImageBytes.length)) {
if (STBImageWrite.stbi_write_jpg_to_func(writeCallback, 0, newWidth, newHeight, 4, scaledPixels, 100) == 0) {
if (STBImageWrite.stbi_write_jpg_to_func(writeCallback, 0, newWidth, newHeight, 4, scaledPixels, 90) == 0) {
throw new IllegalStateException("Failed to write JPEG image: " + STBImage.stbi_failure_reason());
}
return writeCallback.array();
Expand Down

0 comments on commit 89232b7

Please sign in to comment.