Skip to content

Accept HEIC/HEIF Uploads and Convert them to JPEG #785

@macmanx2

Description

@macmanx2

iOS and iPadOS devices now store images as HEIC by default.

As long as "Automatic" or "Most Compatible" is seletect in the browser's upload sheet, the device will convert to JPEG on upload, but if "Current" is selected or the uploader is dragging and dropping from the Photos app on their Mac, an HEIC file will be uploaded and refused.

A big problem with HEIC is that only Safari supports displaying it https://en.wikipedia.org/wiki/High_Efficiency_Image_File_Format#Support so many services simply don't accept it.

A few services do accept HEIC and take on the conversion to JPEG themselves, and maybe MLTSHP could be one of them.

My knowledge in this space is unfortunately limited to just research, but here's how WordPress does HEIC conversion to JPEG on upload:

They experimented with client-side processing but ran into some licensing issues WordPress/gutenberg#61447 but maybe this is something that Fastly could do for us? https://www.fastly.com/documentation/reference/io/

I also asked @newbold who runs https://some.pics which converts HEIC uploads to JPEG, and he gave permission to share that they use heif-convert as a command line utility:

// convert heic/heif if($mime === 'image/heic' || $mime === 'image/heif') { $uploaded_pic_jpg = tempnam("/tmp", "some.pics.jpg."); $convert = shell_exec("heif-convert $uploaded_pic $uploaded_pic_jpg.jpg"); $uploaded_pic = $uploaded_pic_jpg.'.jpg'; $mime = 'image/jpeg'; unlink($uploaded_pic_jpg); }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions