What happens to the transparent parts
JPEG has no alpha channel. A PNG can hold a pixel that is half there; a JPG holds pixels that are there. So every transparent and every part-transparent pixel has to be given an opaque colour, and something has to choose it. Most converters choose without mentioning it. Usually white. Sometimes black, and that is where the black square comes from.
The arithmetic is one line, per channel: the stored colour multiplied by its coverage, plus the matte multiplied by what is left over. On a solid pixel the coverage is one and nothing moves. On the band of part-covered pixels that anti-aliasing leaves along every curve and every letter, the matte shows through in proportion. That band is a pixel or two wide. It is also the only place the choice reads as anything other than a background.
Which is why a mark cut out of a dark panel goes wrong on white. Its part-covered pixels carry the panel's colour, not the mark's, and over white they read as a dirty rim around the shape. Nothing is broken: the file is correct and so is the arithmetic. The repair is to replace the colour in that band with a borrow from the nearest solid pixel, weighted by how little coverage the pixel has, and then run the matte under it.
Converting one file
- 1Drop the PNG, or paste it. The file's own first bytes decide what it is; the name is not consulted.
- 2Press a swatch. The picture under it changes as you press, at preview size, using the arithmetic the export will use at full size.
- 3Leave quality at 86 or move it. The figure beside the button is the size of the file that will be written, measured, not predicted.
- 4Press Save JPG. The file goes to your downloads folder from this tab.
Cases where a PNG should stay a PNG
A screenshot of a form is flat colour, hard type and a short palette. PNG stores that with a run-length pass over rows that mostly repeat, and it stores it exactly. JPEG has to describe every one of those hard edges with frequency coefficients, and hard edges need the high ones, which are the first thing quantisation rounds off. The file often comes out larger and the type always comes out softer.
So the tool encodes the JPG first, at full size, and then compares. If the result is not smaller it says so above the button, with the button still working. The comparison is the real file against the real file. An estimate accurate to within fifteen percent is not accurate enough to print beside a byte count and tell somebody to act on it.
The second case has nothing to do with size. If a third of the image is transparent, the transparency is probably doing a job — a logo that has to sit on other people's backgrounds, an icon that goes on a dark bar next week. Converting it spends that, and the colour you choose today is the colour it has from then on.
Things this tool refuses to do
It will not hit a number of kilobytes.
Forms ask for 50 KB, 100 KB, 200 KB. This page sets a quality and reports the size that came out; it does not run a search for a size. Losing that click is what a real boundary costs.
- It takes PNG. One input format, one output format. That is the whole intake.
- It cannot request a chroma subsampling mode. The canvas encoder in your browser accepts a type and a quality; there is no third argument. What the tool does instead is read the sampling factors back out of the file that was written and print those.
- It writes no metadata into the JPG. Not the orientation it applied, not a colour profile, not a copyright field.
- It converts the first frame of an animated PNG and drops the rest. It says which before the export, not after.
- It does not produce transparency, only remove it, and it does not put a photograph behind a cut-out subject. A matte is a flat fill under the whole frame.
What people ask about the transparent bit
- Why did my PNG turn black?
- Because the converter put black under the transparent pixels and did not say so. JPEG cannot store transparency, so a colour has to go there. Some tools default to black, some leave the buffer uninitialised, which comes out black as well. Here the colour is a swatch you press, and white is only where the row starts.
- Does the transparency come back if I convert the JPG to a PNG again?
- No. The alpha channel is not compressed away, it is spent. Once a transparent pixel has been given a colour, the file holds an ordinary opaque pixel of that colour and nothing distinguishes it from a pixel that was always that colour. Keep the PNG if you might need the transparency later.
- Why is there a grey outline around my logo?
- The artwork was cut out against a different background from the one you are putting it on. Its part-covered edge pixels still carry the old colour. Turn on the edge repair: those pixels take their colour from the nearest solid pixel instead, and then the matte goes under them cleanly.
- Still too big for the form
- This tool picks a quality setting. It does not pick a file size, and it will not search for one. If the form wants a number of kilobytes, that search is compresspicture.com's product and it is a different job from this one.
- Is the JPG the same dimensions as the PNG?
- Yes, unless the file was over the working limit and you agreed to a lighter copy, which is the only case where dimensions move and it is never silent. JPEG itself stops at 65,535 pixels on a side; past that the format is the limit, not this page.
- What happens to the metadata?
- The JPG carries none. An eXIf chunk is read for its orientation value, the rotation is applied, and then the chunk goes with everything else in it. If the PNG held a location, it does not survive the conversion. That is a fact about this tool rather than a feature of it.
Other pages here
- Transparent PNG to JPGThe same converter with the swatch row already open and the edge repair already on.
- PNG to JPG on a white backgroundWhite held in place, for the forms that ask for exactly that.
- Why a PNG turns blackThe single most reported symptom, and the one-line reason for it.
- Choosing a matte colourFour ways to answer the only question this conversion asks.
- When to keep the PNGHow to tell in ten seconds, without opening anything.