Convert a PNG with clear areas to JPG and those areas turn black. The phrase png turns black when converted to jpg describes a problem caused by how JPEG handles see-through pixels. Here is why it happens and how to fix it so your JPG looks the way you intended.

Why Clear PNG Pixels Turn Black in JPG

JPEG does not support an alpha channel. Every pixel in a JPG must be fully opaque. A PNG that uses see-through areas stores two kinds of data for each pixel: the color values (red, green, blue) and the alpha value (how see-through the pixel is). Fully clear pixels still have color values stored. In many cases those values are RGB 0,0,0, which is black. When a converter simply discards the alpha channel to make a JPG, it keeps the color values. Clear pixels become opaque black pixels. This is the direct cause of the transparent png black background jpg problem.

Why Edges Get a Dark Halo

Partial see-through at the edges of an image, often produced by anti-aliasing, also stores color values. If those edge pixels are semi-clear and their stored color is black, they blend with the black fill during conversion. Place the JPG on a white webpage or document later, and those edge pixels appear as a dark fringe. This is the black halo after converting png effect. The same softening that makes edges look smooth in the PNG becomes a dark shadow after conversion.

The Fix Composite Before Saving as JPG

The solution is to composite the PNG onto a solid background color before you encode the JPG. This replaces every clear pixel with the color you choose, so no hidden black data remains to reveal. Composite onto white, gray, or any color that fits your project. Compositing also blends semi-clear edge pixels with the chosen background, eliminating dark halos when you pick a light fill.

Choosing a Background Color

If your image will sit on a white page, composite onto white to get a png to jpg white background. Need a different color? Composite onto that color. The key is to composite before jpg conversion so the output matches its final destination.

How to Composite in Common Image Editors

In GIMP

To composite a PNG onto a solid background in GIMP:

  1. Open your PNG file.
  2. Set the background color you want (for white, leave the default).
  3. Go to the Image menu and choose Flatten Image. This fills all clear areas with the current background color.
  4. Export or save as JPG.

In Photoshop

To composite in Photoshop:

  1. Open your PNG file.
  2. Create a new layer below the artwork and fill it with the color you want (for white, use a white fill).
  3. Merge the layers, or save as JPG with the filled layer in place.

Using ImageMagick (Command Line)

If you prefer a command-line tool, ImageMagick can do the compositing in one step. The command is:

magick input.png -background white -flatten output.jpg

Replace white with another color name (like gray or black) or a hex code to set a different fill.

What If You Need to Keep See-Through Areas?

If your workflow requires clear areas, do not use JPEG. JPEG cannot store see-through data. Any conversion will fill clear areas with a solid color. Keep your file in a format that supports an alpha channel. PNG and WebP both do. Use PNG for lossless images with see-through areas, or WebP when you need smaller file sizes and the same capability.

Preventing the Problem Before Conversion

If you are creating images from scratch, avoid the black fill issue by designing with the final format in mind. If the image will become a JPG, build it on a solid background layer from the start. That way you never have clear pixels that can turn black. Receive a PNG with see-through areas from someone else? Composite it onto the intended background color before you convert it to JPG. This step is simple. It prevents the black halo and black fill problems completely.