[ https://issues.apache.org/jira/browse/IMAGING-284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17312763#comment-17312763 ]
Gary Lucas edited comment on IMAGING-284 at 3/31/21, 11:05 PM: --------------------------------------------------------------- I'm deeply suspicious of this mediafire website. When I attempted to download your file, they tried to push some adware onto my computer and reconfigured my Chrome browser search. On the other hand, the file did download, so I took a look. I wrote a simple test program that read the TIFF file, obtained a buffered image, and then drew that image to an "composite" image with a blue background. Everything seemed to work fine. {code:java} public static void main(String[] args) throws IOException, ImageReadException { File input = new File(args[0]); Map<String, Object> params = new HashMap<>(); BufferedImage bImage = Imaging.getBufferedImage(input, params); int w = bImage.getWidth(); int h = bImage.getHeight(); BufferedImage composite = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); Graphics2D g = composite.createGraphics(); g.setColor(Color.blue); g.fillRect(0, 0, w + 1, h + 1); g.drawImage(bImage, 0, 0, w, h, null); File output = new File("Test.jpg"); System.out.println("Writing image to " + output.getPath()); ImageIO.write(composite, "JPG", output); } {code} !Test.jpg! was (Author: gwlucas): I'm deeply suspicious of this mediafire website. When I attempted to download your file, they tried to push some adware onto my computer and reconfigured my Chrome browser search. On the other hand, the file did download, so I took a look. I wrote a simple test program that read the TIFF file, obtained a buffered image, and then drew that image to an "composite" image with a blue background. Everything seemed to work fine. {code:java} public static void main(String[] args) throws IOException, ImageReadException { File input = new File(args[0]); Map<String, Object> params = new HashMap<>(); BufferedImage bImage = Imaging.getBufferedImage(input, params); int w = bImage.getWidth(); int h = bImage.getHeight(); BufferedImage composite = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); Graphics2D g = composite.createGraphics(); g.setColor(Color.blue); g.fillRect(0, 0, w + 1, h + 1); g.drawImage(bImage, 0, 0, w, h, null); File output = new File("Test.jpg"); System.out.println("Writing image to " + output.getPath()); ImageIO.write(composite, "JPG", output); } {code} !Test.jpg! > Tif file with transparent background result in black background png > ------------------------------------------------------------------- > > Key: IMAGING-284 > URL: https://issues.apache.org/jira/browse/IMAGING-284 > Project: Commons Imaging > Issue Type: Bug > Components: Format: PNG > Reporter: Gaurav Gupta > Priority: Major > Attachments: Test.jpg > > > When a tiff file (sample file [0]) with transparent background is converted > to png file using commons-imaging library, the background in png file is > black instead of transparent. > [0] https://www.mediafire.com/file/tl0r9tsvx6a16zg/Test.tif/file -- This message was sent by Atlassian Jira (v8.3.4#803005)