Why an iPhone photo is not a JPEG, and what renaming it does
Apple switched the default camera format to HEIC in 2017, and the reason was straightforward: it stores a photograph in roughly half the bytes of a JPEG at the same visual quality. HEIC is a container in the ISO base media family, the same family as MP4 video, holding an image compressed with HEVC. That inheritance is exactly the problem. HEVC is patent-encumbered, the licensing is awkward, and no browser ever shipped a decoder for it, so the format that half the phones in the world produce is the format the web cannot read.
What people try first is renaming the file, and it is worth being precise about why that fails. The extension is metadata about a file, not part of it. Changing IMG_0042.HEIC to IMG_0042.jpg changes the label on the outside of the box and nothing inside it. Any program that opens the file reads its leading bytes, finds an ftyp box declaring the brand heic, and knows immediately that it is not the JPEG the name promises. The upload is refused, usually with a message that says nothing useful about which of the two facts was wrong.
A real conversion has to decode the image into pixels and encode those pixels again in the new format. This tool decodes HEIC with libheif compiled to WebAssembly, which is downloaded the first time it is needed and then cached, and encodes through the canvas, which every browser implements. The image is drawn at its exact original dimensions, so nothing is scaled. One detail that gets handled explicitly: JPEG has no alpha channel, and an unpainted canvas is transparent black, so converting a transparent PNG to JPEG without filling the canvas first produces a picture with a black background rather than the white almost everyone expects.
The other detail worth knowing is how support is decided. The canvas encoder takes a MIME type, and if it cannot write that type it does not throw or return null. It falls back to PNG and returns a blob whose type says image/png. A tool that offered every format and trusted the call would produce PNG bytes in a file named .avif, and the failure would surface much later, on somebody else’s machine. So the formats on offer here are probed at load: a one pixel canvas is encoded in each candidate format and the type of the result is checked against what was asked for. Only the ones that answered honestly appear.
Because re-encoding starts from decoded pixels, EXIF does not survive it. The converted copy carries no GPS coordinate, no camera body, no timestamp from the original. That is a side effect rather than the purpose, but it is usually the one people want, and it is the reason converting is often a better answer than renaming even when renaming would have worked.