How to use
- Open bars-32x16.png.
- Set quality 80, then try 60 on the same bars.
- Keep the PNG if you still need a transparent pixel.
Formula / how it works
bars-32x16.png is 32 by 16, red on the left half and blue on the right. At quality 80 the JPEG is 0.8 KB and still 32 by 16. At quality 60 it is also 0.8 KB, because the picture is two flat colours and a short file has little left to cut. A photograph with noise will move more between 60 and 80. The page reports the size it actually wrote, so a flat icon that does not shrink is not dressed up as a win.
JPEG has no alpha. If a pixel in the PNG was transparent, the canvas paints it white before the encode. The note says that even when this particular PNG is fully opaque, so you are not surprised by a logo later. A logo that used transparency to sit on a dark header will grow a white box. If you needed the transparency, keep the PNG.
The browser's JPEG encoder is the one in the canvas. Quality is 1 to 100. The pixel grid is not resized. A 32 by 16 icon stays 32 by 16, which is what you want when you are changing the container and not the layout. The image resizer is a separate page for when the box must change.
EXIF is not copied. GPS that was hiding in the PNG, which is rare, does not come along, because only the pixels are drawn. Colour profiles are not copied either. A wide-gamut PNG may look slightly different in the JPEG. For these bars, the left pixel stays near red and the right pixel stays near blue. JPEG is lossy, so a single pixel can drift by a few levels. It will not swap the halves.
Use WebP to JPG when the source is WebP. Use JPG to PDF when the JPEG should become a page. Use this page when a publisher, an old mail client, or a form only accepts JPEG.
The left half of bars-32x16.png is the red near 220, 30, 30 and the right half is the blue near 20, 40, 200. After the JPEG encode those halves are still on those sides. A publisher who only accepts JPEG can take the 0.8 KB file. A designer who needs the alpha channel should keep the PNG.
A WebP source belongs on WebP to JPG. The JPEG can become a page on JPG to PDF.
Worked examples
Bars at quality 80
Inputs: n2j-f: bars-32x16.png | n2j-q: 80
On this page, take bars-32x16.png, then 80 and press Convert. Expect white where a PNG pixel used to be transparent.
Result: PNG to JPEG: 32×16. If a pixel was transparent, it is now white. 0.8 KB
Bars at quality 60
Inputs: n2j-f: bars-32x16.png | n2j-q: 60
On this page, take bars-32x16.png, then 60 and press Convert. Expect white where a PNG pixel used to be transparent.
Result: PNG to JPEG: 32×16. If a pixel was transparent, it is now white. 0.8 KB
Use cases
- Handing a publisher a JPEG of the red-and-blue bars.
- Seeing that quality 60 did not shrink this flat icon below 0.8 KB.
- Painting a future transparent logo onto white instead of dropping the alpha silently.
- Leaving the 32 by 16 grid alone.
Tips & limitations
- Flat red and blue have little for a JPEG to cut.
- A noisy photograph will move more between quality 60 and 80.
- White replaces transparency. A dark header will show a white box behind a logo.
- EXIF is not copied because only pixels are drawn.
FAQ
Why are both bar JPEGs 0.8 KB?
The PNG is two flat colours at 32 by 16. Quality 80 and quality 60 have almost nothing left to quantise.
Did the pixel grid change?
No. Both downloads are still 32 by 16.
Where does transparency go?
Onto white. JPEG cannot store an alpha channel.
Will a photo behave like these bars?
No. A noisy photo usually changes size when quality drops from 80 to 60. Read the size line.
Is GPS kept?
No. The canvas redraws pixels and drops the metadata.
Which half of the bars is red?
The left half. The right half is blue. JPEG may nudge a level or two, not swap the halves.
0.8 KB is the flat 32 by 16 bars. Do not expect a photograph to land on the same number.