You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Lucas (Jira)" <ji...@apache.org> on 2021/03/31 23:04:00 UTC

[jira] [Issue Comment Deleted] (IMAGING-284) Tif file with transparent background result in black background png

     [ https://issues.apache.org/jira/browse/IMAGING-284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary Lucas updated IMAGING-284:
-------------------------------
    Comment: was deleted

(was: 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.  

The code
{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}
 )

> 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
>
> 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)