question-mark
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.

[Defect] Black background added for transparent images

See original GitHub issue

Description

For allowsEditing set to true, every images picked from library with alpha channel will be black backgrounded:

01 03 04

When editing is disabled, images have white background as expected:

02

How to repeat issue and example

Here is my options passed to ImagePicker.showImagePicker() as first argument:

{
  allowsEditing: true,
  cameraType: 'front',
  maxHeight: 512,
  maxWidth: 512,
  mediaType: 'photo',
  storageOptions: { path: 'images', skipBackup: true },
  title: null,
}

Solution

No solutions proposed yet.

Additional Information

  • React Native version: react-native@0.46.4
  • Platform: iOS (not tested on Android)
  • Development Operating System: macOS Sierra 10.12.5
  • Dev tools: Xcode 8

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:12

github_iconTop GitHub Comments

2reactions
douglasjuniorcommented, Feb 21, 2020

I discovered the problem. When using “maxHeight” or “maxWidth”, the image is converted from PNG to JPEG, causing the transparent area to be converted to black.

Is there any way to keep the image in PNG?

1reaction
odyodyodyscommented, Feb 22, 2021

Any updates on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pasted transparent PNG files have a black background
I am experiencing an issue with all transparent png files copied from Chrome and pasted into Photoshop CS6. The background is black rather...
Read more >
[Defect] Black background added for transparent images
Have you figured out this issue? I cant seem to remove the white backgrounds from png image. It was black until I removed...
Read more >
How to Fix Black Transparent PNG Background in File ...
How to Remove Black Background on Transparent PNG Images in File Explorer. Method #1 – Change Your View Type. It is possible that...
Read more >
Getting a Black Background on Transparent Images - Shopify ...
Solved: I have a handful of products that I have transparent backgrounds on, and on the product pages they show up with a...
Read more >
How to Fix a Transparent Image That Appears With a Black ...
When a PNG image with a transparent background is selected from the Recent FIle selector and appears with a black background, the black...
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 Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found