Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resizing an index-paletted transparent PNG results in a black background

See original GitHub issue
I want to resize a png file in following code:
  Thumbnails.of(srcImg).size(width, height).toFile(optImg)

But all transparent background turns to black.
See the attach
What should I do?

thumbnailator-0.4.0 in sun/oracle jdk1.7

Thank you very much!

Original issue reported on by on 8 Nov 2012 at 4:27


Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:23 (1 by maintainers)

github_iconTop GitHub Comments

ahtabbasicommented, Sep 19, 2017

I have found a solution for this, might help others. Please test and verify.

I replaced below code:

BufferedImage finalImage = Thumbnails.of(temp)
                        .size(videoWidth, videoHeight)                    


BufferedImage finalImage = Thumbnails.of(temp)
                        .size(videoWidth, videoHeight)                        

Input image used was indexed 8 bit png with transparency.

jforjava1981commented, Aug 20, 2015

+1: We will also like to have this feature.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resizing an indexed image in Java without losing transparency
So we did the resize on a new ARGB image and then we reduce it to 256 colors. The problem is how to...
Read more >
Customize indexed color tables in Photoshop - Adobe Support
Choose Image > Mode > Color Table. To change a single color, click the color and choose a new color in the Color...
Read more >
PNG with indexed palette and semitransparent colors loses ...
The only solution is to save the image in RGB mode and convert it back to 4 bit with optipng later. … Expected...
Read more >
Chapter 6 - Image Manipulation - The mtPaint Handbook
The type of effects available will depend on whether your are editing an indexed palette image or an RGB image. 6.6.1 Bacteria. Here...
Read more >
Remove a Background Basics - Acorn - Flying Meat
Click once on the color well to the right of where it says 'Remove'. This will bring up the colors palette. Click on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found