[Git][java-team/libthumbnailator-java][upstream] New upstream version 0.4.21

Emmanuel Bourg (@ebourg) gitlab at salsa.debian.org
Wed Nov 11 00:23:29 GMT 2026



Emmanuel Bourg pushed to branch upstream at Debian Java Maintainers / libthumbnailator-java


Commits:
c5ee665f by Emmanuel Bourg at 2026-11-10T23:15:50+01:00
New upstream version 0.4.21
- - - - -


7 changed files:

- LICENSE
- README.md
- pom.xml
- src/main/java/net/coobird/thumbnailator/resizers/ProgressiveBilinearResizer.java
- src/main/resources/META-INF/LICENSE
- src/test/java/net/coobird/thumbnailator/ThumbnailsBuilderInputOutputTest.java
- + src/test/java/net/coobird/thumbnailator/resizers/Issue225ResizeTest.java


Changes:

=====================================
LICENSE
=====================================
@@ -1,6 +1,6 @@
 MIT License
 
-Copyright (c) 2008-2023 Chris Kroells
+Copyright (c) 2008-2025 Chris Kroells
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal


=====================================
README.md
=====================================
@@ -1,4 +1,4 @@
-_*June 28, 2023: Thumbnailator 0.4.20 has been released!
+_*October 1, 2025: Thumbnailator 0.4.21 has been released!
 See [Changes](https://github.com/coobird/thumbnailator/wiki/Changes) for details.*_
 
 _*Thumbnailator is now available through
@@ -49,7 +49,7 @@ The following pages have more information on what _Thumbnailator_ can do:
 
 * [Features](https://github.com/coobird/thumbnailator/wiki/Features)
 * [Examples](https://github.com/coobird/thumbnailator/wiki/Examples)
-* [Thumbnailator API Documentation](https://coobird.github.io/thumbnailator/javadoc/0.4.20/)
+* [Thumbnailator API Documentation](https://coobird.github.io/thumbnailator/javadoc/0.4.21/)
 * [Frequently Asked Questions](https://github.com/coobird/thumbnailator/wiki/FAQ)
 
 # Disclaimer


=====================================
pom.xml
=====================================
@@ -2,7 +2,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>net.coobird</groupId>
   <artifactId>thumbnailator</artifactId>
-  <version>0.4.20</version>
+  <version>0.4.21</version>
   <packaging>jar</packaging>
   <name>thumbnailator</name>
   <description>Thumbnailator - a thumbnail generation library for Java</description>
@@ -26,16 +26,6 @@
       <url>https://coobird.net</url>
     </developer>
   </developers>
-  <distributionManagement>
-    <snapshotRepository>
-      <id>ossrh</id>
-      <url>https://oss.sonatype.org/content/repositories/snapshots</url>
-    </snapshotRepository>
-    <repository>
-      <id>ossrh</id>
-      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
-    </repository>
-  </distributionManagement>
   <build>
     <plugins>
       <plugin>
@@ -244,14 +234,12 @@
             </executions>
           </plugin>
           <plugin>
-            <groupId>org.sonatype.plugins</groupId>
-            <artifactId>nexus-staging-maven-plugin</artifactId>
-            <version>1.6.3</version>
+            <groupId>org.sonatype.central</groupId>
+            <artifactId>central-publishing-maven-plugin</artifactId>
+            <version>0.7.0</version>
             <extensions>true</extensions>
             <configuration>
-              <serverId>ossrh</serverId>
-              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
-              <autoReleaseAfterClose>false</autoReleaseAfterClose>
+              <publishingServerId>central</publishingServerId>
             </configuration>
           </plugin>
         </plugins>


=====================================
src/main/java/net/coobird/thumbnailator/resizers/ProgressiveBilinearResizer.java
=====================================
@@ -1,7 +1,7 @@
 /*
  * Thumbnailator - a thumbnail generation library
  *
- * Copyright (c) 2008-2020 Chris Kroells
+ * Copyright (c) 2008-2025 Chris Kroells
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -38,17 +38,21 @@ import java.util.Map;
  * progressive bilinear scaling.
  * <p>
  * The resizing technique used in this class is based on the technique
- * discussed in <em>Chapter 4: Images</em> of
- * <a href="http://filthyrichclients.org">Filthy Rich Clients</a>
+ * discussed in <em>Chapter 4: Images</em> of <em>Filthy Rich Clients</em>
  * by Chet Haase and Romain Guy.
  * <p>
- * The actual implemenation of the technique is independent of the code which
+ * The actual implementation of the technique is independent of the code which
  * is provided in the book.
  * 
  * @author coobird
  *
  */
 public class ProgressiveBilinearResizer extends AbstractResizer {
+	/**
+	 * A resizer that's used when a single-step resize is needed.
+	 */
+	private final BilinearResizer bilinearResizer;
+
 	/**
 	 * Instantiates a {@link ProgressiveBilinearResizer} with default
 	 * rendering hints.
@@ -65,11 +69,15 @@ public class ProgressiveBilinearResizer extends AbstractResizer {
 	 */
 	public ProgressiveBilinearResizer(Map<RenderingHints.Key, Object> hints) {
 		super(RenderingHints.VALUE_INTERPOLATION_BILINEAR, hints);
+		bilinearResizer = new BilinearResizer(getRenderingHints());
 	}
 	
 	/**
 	 * Resizes an image using the progressive bilinear scaling technique.
 	 * <p>
+	 * When the source image isn't at least twice as large as the destination
+	 * image for both dimensions, a regular one-step scaling is performed.
+	 * <p>
 	 * If the source and/or destination image is {@code null}, then a
 	 * {@link NullPointerException} will be thrown.
 	 * 
@@ -90,24 +98,16 @@ public class ProgressiveBilinearResizer extends AbstractResizer {
 		final int targetWidth = destImage.getWidth();
 		final int targetHeight = destImage.getHeight();
 		
-		// If multi-step downscaling is not required, perform one-step.
+		/*
+		 * Only perform a progressive bilinear scaling when both width and
+		 * height are at least twice as large as the target.
+		 * In other situations, fallback to using a one-step bilinear resize.
+		 */
 		if ((targetWidth * 2 >= currentWidth) && (targetHeight * 2 >= currentHeight)) {
-			Graphics2D g = createGraphics(destImage);
-			g.drawImage(srcImage, 0, 0, targetWidth, targetHeight, null);
-			g.dispose();
+			bilinearResizer.resize(srcImage, destImage);
 			return;
 		}
 		
-		// Temporary image used for in-place resizing of image.
-		BufferedImage tempImage = new BufferedImageBuilder(
-				currentWidth,
-				currentHeight,
-				destImage.getType()
-		).build();
-		
-		Graphics2D g = createGraphics(tempImage);
-		g.setComposite(AlphaComposite.Src);
-		
 		/*
 		 * Determine the size of the first resize step should be.
 		 * 1) Beginning from the target size
@@ -121,15 +121,32 @@ public class ProgressiveBilinearResizer extends AbstractResizer {
 			startWidth *= 2;
 			startHeight *= 2;
 		}
-		
+
+		// FIXME This probably should have been rounded rather than truncated.
 		currentWidth = startWidth / 2;
 		currentHeight = startHeight / 2;
 
+		// Temporary image used for in-place resizing of image.
+		/*
+		 * Special case for `width` and `height` when they're `0`.
+		 * This can happen when the target dimension is `1`.
+		 * This is caused by integer truncation in the previous lines.
+		 */
+		BufferedImage tempImage = new BufferedImageBuilder(
+				Math.max(1, currentWidth),
+				Math.max(1, currentHeight),
+				destImage.getType()
+		).build();
+
+		Graphics2D g = createGraphics(tempImage);
+		g.setComposite(AlphaComposite.Src);
+
 		// Perform first resize step.
 		g.drawImage(srcImage, 0, 0, currentWidth, currentHeight, null);
 		
 		// Perform an in-place progressive bilinear resize.
 		while (	(currentWidth >= targetWidth * 2) && (currentHeight >= targetHeight * 2) ) {
+			// FIXME Probably should be rounding rather than truncating.
 			currentWidth /= 2;
 			currentHeight /= 2;
 			


=====================================
src/main/resources/META-INF/LICENSE
=====================================
@@ -1,6 +1,6 @@
 MIT License
 
-Copyright (c) 2008-2023 Chris Kroells
+Copyright (c) 2008-2025 Chris Kroells
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal


=====================================
src/test/java/net/coobird/thumbnailator/ThumbnailsBuilderInputOutputTest.java
=====================================
@@ -1,7 +1,7 @@
 /*
  * Thumbnailator - a thumbnail generation library
  *
- * Copyright (c) 2008-2022 Chris Kroells
+ * Copyright (c) 2008-2023 Chris Kroells
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -61,6 +61,8 @@ import net.coobird.thumbnailator.name.Rename;
 import net.coobird.thumbnailator.test.BufferedImageAssert;
 import net.coobird.thumbnailator.test.BufferedImageComparer;
 
+import net.coobird.thumbnailator.util.exif.ExifFilterUtils;
+import net.coobird.thumbnailator.util.exif.Orientation;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.runners.Enclosed;
@@ -2287,14 +2289,29 @@ public class ThumbnailsBuilderInputOutputTest {
 	@RunWith(Parameterized.class)
 	public static class OrientationTests {
 
-		@Parameterized.Parameters(name = "orientation={0}")
-		public static Object[] values() {
-			return new Integer[] { 1, 2, 3, 4, 5, 6, 7, 8 };
+		@Parameterized.Parameters(name = "orientation={0}, sourcePathPattern={1}, width={2}, height={3}")
+		public static Collection<Object[]> values() {
+			List<Object[]> values = new ArrayList<Object[]>();
+			for (int i = 1; i <= 8; i++) {
+				values.add(new Object[] { i, "source", 80, 80 });
+				values.add(new Object[] { i, "sourceWide", 80, 40 });
+				values.add(new Object[] { i, "sourceTall", 40, 80 });
+			}
+			return values;
 		}
 
 		@Parameterized.Parameter
 		public int orientation;
 
+		@Parameterized.Parameter(1)
+		public String source;
+
+		@Parameterized.Parameter(2)
+		public int width;
+
+		@Parameterized.Parameter(3)
+		public int height;
+
 		@Rule
 		public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
@@ -2313,164 +2330,90 @@ public class ThumbnailsBuilderInputOutputTest {
 		public void correctOrientationFromFile() throws IOException {
 			// given
 			File sourceFile = TestUtils.copyResourceToTemporaryFile(
-					String.format("Exif/source_%s.jpg", orientation),
+					String.format("Exif/%s_%s.jpg", source, orientation),
 					temporaryFolder
 			);
 
 			// when
 			BufferedImage result =
 					Thumbnails.of(sourceFile)
-							.size(100, 100)
+							.size(width, height)
 							.asBufferedImage();
 
 			// then
 			assertOrientation(result);
-			assertEquals(100, result.getWidth());
-			assertEquals(100, result.getHeight());
-		}
-
-		@Test
-		public void correctOrientationWideFromFile() throws IOException {
-			// given
-			File sourceFile = TestUtils.copyResourceToTemporaryFile(
-					String.format("Exif/sourceWide_%s.jpg", orientation),
-					temporaryFolder
-			);
-
-			// when
-			BufferedImage result =
-					Thumbnails.of(sourceFile)
-							.size(80, 40)
-							.asBufferedImage();
-
-			// then
-			assertOrientation(result);
-			assertEquals(80, result.getWidth());
-			assertEquals(40, result.getHeight());
-		}
-
-		@Test
-		public void correctOrientationTallFromFile() throws IOException {
-			// given
-			File sourceFile = TestUtils.copyResourceToTemporaryFile(
-					String.format("Exif/sourceTall_%s.jpg", orientation),
-					temporaryFolder
-			);
-
-			// when
-			BufferedImage result =
-					Thumbnails.of(sourceFile)
-							.size(40, 80)
-							.asBufferedImage();
-
-			// then
-			assertOrientation(result);
-			assertEquals(40, result.getWidth());
-			assertEquals(80, result.getHeight());
-		}
-
-		@Test
-		public void correctOrientationWideScaleFromFile() throws IOException {
-			// given
-			File sourceFile = TestUtils.copyResourceToTemporaryFile(
-					String.format("Exif/sourceWide_%s.jpg", orientation),
-					temporaryFolder
-			);
-
-			// when
-			BufferedImage result =
-					Thumbnails.of(sourceFile)
-							.scale(0.5)
-							.asBufferedImage();
-
-			// then
-			assertOrientation(result);
-			assertEquals(80, result.getWidth());
-			assertEquals(40, result.getHeight());
-		}
-
-		@Test
-		public void correctOrientationTallScaleFromFile() throws IOException {
-			// given
-			File sourceFile = TestUtils.copyResourceToTemporaryFile(
-					String.format("Exif/sourceTall_%s.jpg", orientation),
-					temporaryFolder
-			);
-
-			// when
-			BufferedImage result =
-					Thumbnails.of(sourceFile)
-							.scale(0.5)
-							.asBufferedImage();
-
-			// then
-			assertOrientation(result);
-			assertEquals(40, result.getWidth());
-			assertEquals(80, result.getHeight());
+			assertEquals(width, result.getWidth());
+			assertEquals(height, result.getHeight());
 		}
 
 		@Test
 		public void correctOrientationFromInputStream() throws Exception {
 			// given
 			InputStream is = TestUtils.getResourceStream(
-					String.format("Exif/source_%s.jpg", orientation)
+					String.format("Exif/%s_%s.jpg", source, orientation)
 			);
 
 			// when
 			BufferedImage result =
 					Thumbnails.of(is)
-							.size(100, 100)
+							.size(width, height)
 							.asBufferedImage();
 
 			// then
 			assertOrientation(result);
-			assertEquals(100, result.getWidth());
-			assertEquals(100, result.getHeight());
+			assertEquals(width, result.getWidth());
+			assertEquals(height, result.getHeight());
 		}
 
+		/*
+		 * These test cases reflect Thumbnailator usage where `BufferedImage`
+		 * is used and Exif orientation is determined by other means.
+		 */
 		@Test
-		public void correctOrientationWideFromInputStream() throws Exception {
+		public void correctOrientationFromBufferedImage() throws IOException {
 			// given
 			InputStream is = TestUtils.getResourceStream(
-					String.format("Exif/sourceWide_%s.jpg", orientation)
+					String.format("Exif/%s_%s.jpg", source, orientation)
 			);
 
 			// when
 			BufferedImage result =
-					Thumbnails.of(is)
-							.size(80, 40)
+					Thumbnails.of(ImageIO.read(is))
+							.addFilter(ExifFilterUtils.getFilterForOrientation(Orientation.typeOf(orientation)))
+							.size(width, height)
 							.asBufferedImage();
 
 			// then
 			assertOrientation(result);
-			assertEquals(80, result.getWidth());
-			assertEquals(40, result.getHeight());
+			assertEquals(width, result.getWidth());
+			assertEquals(height, result.getHeight());
 		}
 
 		@Test
-		public void correctOrientationTallFromInputStream() throws Exception {
+		public void correctOrientationScaleFromFile() throws IOException {
 			// given
-			InputStream is = TestUtils.getResourceStream(
-					String.format("Exif/sourceTall_%s.jpg", orientation)
+			File sourceFile = TestUtils.copyResourceToTemporaryFile(
+					String.format("Exif/%s_%s.jpg", source, orientation),
+					temporaryFolder
 			);
 
 			// when
 			BufferedImage result =
-					Thumbnails.of(is)
-							.size(40, 80)
+					Thumbnails.of(sourceFile)
+							.scale(0.5)
 							.asBufferedImage();
 
 			// then
 			assertOrientation(result);
-			assertEquals(40, result.getWidth());
-			assertEquals(80, result.getHeight());
+			assertEquals(width, result.getWidth());
+			assertEquals(height, result.getHeight());
 		}
 
 		@Test
-		public void correctOrientationWideScaleFromInputStream() throws Exception {
+		public void correctOrientationScaleFromInputStream() throws Exception {
 			// given
 			InputStream is = TestUtils.getResourceStream(
-					String.format("Exif/sourceWide_%s.jpg", orientation)
+					String.format("Exif/%s_%s.jpg", source, orientation)
 			);
 
 			// when
@@ -2481,27 +2424,33 @@ public class ThumbnailsBuilderInputOutputTest {
 
 			// then
 			assertOrientation(result);
-			assertEquals(80, result.getWidth());
-			assertEquals(40, result.getHeight());
+			assertEquals(width, result.getWidth());
+			assertEquals(height, result.getHeight());
 		}
 
+		/*
+		 * These test cases reflect Thumbnailator usage where `BufferedImage`
+		 * is used and Exif orientation is determined by other means.
+		 */
 		@Test
-		public void correctOrientationTallScaleFromInputStream() throws Exception {
+		public void correctOrientationScaleFromBufferedImage() throws IOException {
 			// given
-			InputStream is = TestUtils.getResourceStream(
-					String.format("Exif/sourceTall_%s.jpg", orientation)
+			File sourceFile = TestUtils.copyResourceToTemporaryFile(
+					String.format("Exif/%s_%s.jpg", source, orientation),
+					temporaryFolder
 			);
 
 			// when
 			BufferedImage result =
-					Thumbnails.of(is)
+					Thumbnails.of(ImageIO.read(sourceFile))
+							.addFilter(ExifFilterUtils.getFilterForOrientation(Orientation.typeOf(orientation)))
 							.scale(0.5)
 							.asBufferedImage();
 
 			// then
 			assertOrientation(result);
-			assertEquals(40, result.getWidth());
-			assertEquals(80, result.getHeight());
+			assertEquals(width, result.getWidth());
+			assertEquals(height, result.getHeight());
 		}
 	}
 


=====================================
src/test/java/net/coobird/thumbnailator/resizers/Issue225ResizeTest.java
=====================================
@@ -0,0 +1,193 @@
+/*
+ * Thumbnailator - a thumbnail generation library
+ *
+ * Copyright (c) 2008-2025 Chris Kroells
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package net.coobird.thumbnailator.resizers;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+ at RunWith(Parameterized.class)
+public class Issue225ResizeTest {
+
+    private static final Color[][] COLOR_BLOCKS = new Color[][] {
+            new Color[] { Color.red, Color.green, Color.blue },
+            new Color[] { Color.green, Color.blue, Color.red },
+            new Color[] { Color.blue, Color.red, Color.green }
+    };
+
+    private static final int SOURCE_WIDTH = 120;
+    private static final int SOURCE_HEIGHT = 240;
+
+    /**
+     * Creates a RGB test pattern consisting of 3 columns by 6 rows.
+     */
+    private BufferedImage createTestImage() {
+        int width = SOURCE_WIDTH;
+        int height = SOURCE_HEIGHT;
+
+        BufferedImage img = new BufferedImage(width, height, imageType);
+        Graphics g = img.createGraphics();
+        g.setColor(Color.white);
+        g.fillRect(0, 0, width, height);
+
+        int blockSize = 40;
+        int i = 0;
+        for (int y = 0; y < height; y += blockSize) {
+            g.setColor(COLOR_BLOCKS[i % 3][0]);
+            g.fillRect(0, y, blockSize, blockSize);
+            g.setColor(COLOR_BLOCKS[i % 3][1]);
+            g.fillRect(blockSize, y, blockSize, blockSize);
+            g.setColor(COLOR_BLOCKS[i % 3][2]);
+            g.fillRect(blockSize * 2, y, blockSize, blockSize);
+            i++;
+        }
+
+        g.dispose();
+        return img;
+    }
+
+    private static int round(double v) {
+        // Floor should be close enough for most test cases.
+        // It's required for the 3x6 destination size case to work.
+        return (int) Math.floor(v);
+    }
+
+    /**
+     * Check each color block to verify if expected color is present.
+     */
+    private static void assertImage(BufferedImage img) {
+        int width = img.getWidth();
+        int height = img.getHeight();
+
+        double blockWidth = width / 3.0;
+        double blockHeight = height / 6.0;
+        double halfBlockWidth = blockWidth / 2.0;
+        double halfBlockHeight = blockHeight / 2.0;
+
+        for (int i = 0; i < 6; i++) {
+            for (int j = 0; j < 3; j++) {
+                int x = round((blockWidth * j) + halfBlockWidth);
+                int y = round((blockHeight * (i % 3)) + halfBlockHeight);
+                assertEquals(
+                        String.format("mismatch at i=%s, j=%s", i, j),
+                        COLOR_BLOCKS[i % 3][j],
+                        new Color(img.getRGB(x, y))
+                );
+            }
+        }
+    }
+    
+    @Parameterized.Parameters(name = "width={0}, height={1}, imageType={2}")
+    public static Collection<Object[]> testCases() {
+        List<Integer> imageTypes = Arrays.asList(
+                BufferedImage.TYPE_INT_ARGB,
+                BufferedImage.TYPE_INT_RGB
+        );
+        
+        List<Dimension> dimensions = Arrays.asList(
+                new Dimension(SOURCE_WIDTH, SOURCE_HEIGHT),
+                new Dimension(SOURCE_WIDTH * 2, SOURCE_HEIGHT * 2),
+                new Dimension(SOURCE_WIDTH * 3, SOURCE_HEIGHT * 3),
+                new Dimension(SOURCE_WIDTH / 2, SOURCE_HEIGHT / 2),
+                new Dimension(SOURCE_WIDTH / 3, SOURCE_HEIGHT / 3),
+                
+                // Test cases for aspect ratio not preserved
+                new Dimension(SOURCE_WIDTH * 2, SOURCE_HEIGHT / 2),
+                new Dimension(SOURCE_WIDTH / 2, SOURCE_HEIGHT * 2),
+                new Dimension(SOURCE_WIDTH * 3, SOURCE_HEIGHT / 3),
+                new Dimension(SOURCE_WIDTH / 3, SOURCE_HEIGHT * 3),
+
+                // Smallest possible dimensions without losing color detail.
+                new Dimension(3, 6),
+                new Dimension(6, 12)
+        );
+        
+        List<Object[]> testCases = new ArrayList<Object[]>();
+        for (int imageType : imageTypes) {
+            for (Dimension dimension : dimensions) {
+                testCases.add(
+                        new Object[] {
+                                dimension.width,
+                                dimension.height,
+                                imageType
+                        }
+                );
+            }
+        }
+        
+        return testCases;
+    }
+
+    @Parameterized.Parameter
+    public int width;
+
+    @Parameterized.Parameter(1)
+    public int height;
+
+    @Parameterized.Parameter(2)
+    public int imageType;
+
+    private void resizerTest(Resizer resizer) {
+        // given
+        BufferedImage sourceImage = createTestImage();
+        BufferedImage thumbnail = new BufferedImage(width, height, imageType);
+
+        // when
+        resizer.resize(sourceImage, thumbnail);
+
+        // then
+        assertEquals(
+                new Dimension(width, height),
+                new Dimension(thumbnail.getWidth(), thumbnail.getHeight())
+        );
+        assertImage(thumbnail);
+    }
+
+    @Test
+    public void bilinearResizerTest() {
+        resizerTest(Resizers.BILINEAR);
+    }
+
+    @Test
+    public void bicubicResizerTest() {
+        resizerTest(Resizers.BICUBIC);
+    }
+
+    @Test
+    public void progressiveResizerTest() {
+        resizerTest(Resizers.PROGRESSIVE);
+    }
+}



View it on GitLab: https://salsa.debian.org/java-team/libthumbnailator-java/-/commit/c5ee665f7f6b0b3c936b35034ed285f6ea7a754a

-- 
View it on GitLab: https://salsa.debian.org/java-team/libthumbnailator-java/-/commit/c5ee665f7f6b0b3c936b35034ed285f6ea7a754a
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20261111/300a847d/attachment.htm>


More information about the pkg-java-commits mailing list