You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ki...@apache.org on 2023/01/16 21:10:21 UTC

[commons-imaging] branch master updated (72a9ccf5 -> eb102a0a)

This is an automated email from the ASF dual-hosted git repository.

kinow pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git


    from 72a9ccf5 Fix typos
     new 6caad1b2 use the byte array where the image is stored, remove the tmp file usage
     new eb102a0a since we use a pngImageParser the tmp file must be named with .png instead of gif

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../commons/imaging/formats/png/PngWriteForceTrueColorText.java  | 2 +-
 .../apache/commons/imaging/roundtrip/PixelDensityRoundtrip.java  | 9 +++------
 2 files changed, 4 insertions(+), 7 deletions(-)


[commons-imaging] 01/02: use the byte array where the image is stored, remove the tmp file usage

Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kinow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git

commit 6caad1b2f76ad18e6e99b99d1d04d3cac95656a1
Author: Matthieu Casanova <kp...@users.sourceforge.net>
AuthorDate: Sun Jan 15 22:18:53 2023 +0100

    use the byte array where the image is stored, remove the tmp file usage
---
 .../apache/commons/imaging/roundtrip/PixelDensityRoundtrip.java  | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/test/java/org/apache/commons/imaging/roundtrip/PixelDensityRoundtrip.java b/src/test/java/org/apache/commons/imaging/roundtrip/PixelDensityRoundtrip.java
index 6fdcc4a7..2a0e8040 100644
--- a/src/test/java/org/apache/commons/imaging/roundtrip/PixelDensityRoundtrip.java
+++ b/src/test/java/org/apache/commons/imaging/roundtrip/PixelDensityRoundtrip.java
@@ -27,8 +27,6 @@ import org.junit.jupiter.params.provider.MethodSource;
 
 import java.awt.image.BufferedImage;
 import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.nio.file.Files;
 import java.util.stream.Stream;
 
 import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -44,15 +42,14 @@ public class PixelDensityRoundtrip extends RoundtripBase {
     public void testPixelDensityRoundtrip(final FormatInfo formatInfo) throws Exception {
         final BufferedImage testImage = TestImages.createFullColorImage(2, 2);
 
-        final File temp1 = Files.createTempFile("pixeldensity.", "." + formatInfo.format.getDefaultExtension()).toFile();
-
         final TiffImagingParameters params = new TiffImagingParameters();
         final PixelDensity pixelDensity = PixelDensity.createFromPixelsPerInch(75, 150);
         params.setPixelDensity(pixelDensity);
         final TiffImageParser tiffImageParser = new TiffImageParser();
-        tiffImageParser.writeImage(testImage, new ByteArrayOutputStream(), params);
+        final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        tiffImageParser.writeImage(testImage, byteArrayOutputStream, params);
 
-        final ImageInfo imageInfo = Imaging.getImageInfo(temp1);
+        final ImageInfo imageInfo = Imaging.getImageInfo(byteArrayOutputStream.toByteArray());
         if (imageInfo != null) {
             final int xReadDPI = imageInfo.getPhysicalWidthDpi();
             final int yReadDPI = imageInfo.getPhysicalHeightDpi();


[commons-imaging] 02/02: since we use a pngImageParser the tmp file must be named with .png instead of gif

Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kinow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-imaging.git

commit eb102a0a7b8677e16a1f588da1cce6f0af2d6c8b
Author: Bruno P. Kinoshita <ki...@users.noreply.github.com>
AuthorDate: Wed May 11 06:46:54 2022 +0200

    since we use a pngImageParser the tmp file must be named with .png instead of gif
---
 .../apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java b/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java
index 0bd0a7b9..9876513c 100644
--- a/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java
+++ b/src/test/java/org/apache/commons/imaging/formats/png/PngWriteForceTrueColorText.java
@@ -50,7 +50,7 @@ public class PngWriteForceTrueColorText extends PngBaseTest {
                 final BufferedImage image = pngImageParser.getBufferedImage(imageFile, new PngImagingParameters());
                 assertNotNull(image);
 
-                final File outFile = Files.createTempFile(imageFile.getName() + ".", ".gif").toFile();
+                final File outFile = Files.createTempFile(imageFile.getName() + ".", ".png").toFile();
                 // Debug.debug("outFile", outFile);
 
                 final PngImagingParameters params = new PngImagingParameters();