Page MenuHomePhabricator

Automatically convert .heic image format files to .jpg or .webp
Open, Needs TriagePublic

Description

https://commons.wikimedia.org/wiki/Commons:Village_pump/Technical#Adding_HEIC_format_images_to_commons

User has an iPhone, took photos themselves (so we'd be happy to have them) but can't upload because https://en.wikipedia.org/wiki/High_Efficiency_Image_File_Format is patent-encumbered.

So can't those files be converted automatically to .jpg or .webp?

Event Timeline

Yeah , they can be converted but they are loosing sensitive information like location, date etc...

An 'ideal' converter should be about to keep them in EXIF, if that is the intention.

Removing Wikimedia-Site-requests as this task is not about changing a configuration entry from something existing to something else existing. Please see https://meta.wikimedia.org/wiki/Requesting_wiki_configuration_changes

So can't those files be converted automatically to .jpg or .webp?

It looks like the ImageMagick software supports conversion since version 7.0.7-22 if compiled with --with-libheif according to https://github.com/ImageMagick/ImageMagick/issues/507 . Also see https://photo.stackexchange.com/questions/91640/how-can-i-convert-an-apple-ios-heif-image-into-jpeg

According to https://packages.debian.org/search?keywords=ImageMagick , Debian (the distribution used on Wikimedia servers) only ships ImageMagick version 6.9.x which means this likely will not happen soon.

@Aklapper okay, sorry, I didn't know how to tag this as a feature request. Can the mobile app convert it? (I guess that would only help for Android, which is maybe more likely to use .webp anyway..) Can it be converted with JavaScript? Could a project an Wikimedia Toolforge handle it?

UIAM the WMF would want to keep the original file(s) as well, so that when the HEIF patents expire it could be made available, but there is currently no support for that type of file stashing in the software (see T120454).

UIAM the WMF would want to keep the original file(s) as well, so that when the HEIF patents expire it could be made available, but there is currently no support for that type of file stashing in the software (see T120454).

It will be good, if we can actually upload these files to commons, later they'll automatically show up after copyright's expiration.

FYI Safari just added to their development version an automatic heic to png or jpg conversion, if a website doesn't support heic/heif for upload.
https://trac.webkit.org/changeset/263949/webkit/

It looks like the ImageMagick software supports conversion since version 7.0.7-22 if compiled with --with-libheif according to https://github.com/ImageMagick/ImageMagick/issues/507 . Also see https://photo.stackexchange.com/questions/91640/how-can-i-convert-an-apple-ios-heif-image-into-jpeg

According to https://packages.debian.org/search?keywords=ImageMagick , Debian (the distribution used on Wikimedia servers) only ships ImageMagick version 6.9.x which means this likely will not happen soon.

Debian 10 (Buster) and Debian 11 (bullseye) both have version 6.9.x of ImageMagick, but both distributions support heic/heif with the distributions supplied ImageMagic. There is no need for version 7 for this to work.

Yeah , they can be converted but they are loosing sensitive information like location, date etc...

From personal experience with the usual APIs this is not true, EXIF data does indeed remain including camera model, GPS etc.
When using SwiftUI's PhotosPicker for example and specifying preferredItemEncoding: .compatible, the file items are exposed as jpegs with all EXIF info that is useful for commons.
When using UIKit via PHPickerViewController, the same config can be specified.

I think EXIF data is also preserved when using UIImage's jpgedData(), but not 100% on that. But when using one of the above image pickers, which is the standard way to access user images, it shouldn't be necessary to use that method in the first place.

is patent-encumbered

but here I read

Open format? Depends on contained format (e.g. HEIC vs. free AV1 Image File Format)

Converting to jpg/png is bad - because they are less efficient than modern avif

but here I read

@vitaly-zdanevich: See the task title which mentions HEIC. Also, "bad" is nonsense. See our required Grade C support, in addition to caniuse.com.