66

Apple has introduced a new image format in iOS 11 called HEIF (.heic file extension). I know you can export images as JPG from iOS devices, but I want to upload the HEIC-files to my server and convert them there to JPEG files that can be shown on all other devices.

Can anyone recommend a good and efficient way to achieve this?

ANSWER:

Since this question has been closed, I will edit in my answer here for the rest of you. We now use this library for converting HEIC to JPEG: https://github.com/monostream/tifig

Also ImageMagick now support converting HEIC to JPEG thanks to a fork from @toshic

Thank you to @monostream and @toshic for your great contributions!

EDIT1: Edited the wording of the question to be more specific and meet SO guidelines

EDIT2: Added answer since this topic is now closed :/

Community
  • 1
  • 1
Christian
  • 852
  • 1
  • 8
  • 13
  • In server it will be uploaded as Data format so you do work around and maintain data in Jpg in server and in client side i.e Device that conversion will be handled locally and format can b judged via meta Info – Abhishek Thapliyal Aug 03 '17 at 08:52
  • @AbhishekThapliyal I think you misunderstand. Yes, I send the image as data to the server, but to be able to show it in common browsers and clients not supporting HEIC, I want to convert it to JPEG on the server first. This is not something I want to do on the clients. – Christian Aug 07 '17 at 07:33
  • 4
    I would like to know this too. I think the hold should be removed. – Tom Kincaid Oct 17 '17 at 14:23
  • See my answer [here](https://askubuntu.com/questions/958355/any-app-on-ubuntu-to-open-heif-heic-high-efficiency-image-file-format-pictur/973656#973656) – Digger Nov 06 '17 at 20:54
  • 2
    https://github.com/monostream/tifig – Flask Nov 09 '17 at 10:45
  • 1
    After adding the related codecs/libs: libheif-examples and libheif-dev, I compiled imagemagick on my own for instruction checkout Imagemagick on ubuntu I also installed graphicmagick which is required, since I am using gm nodejs library to do the conversion. Nodejs code: imageMagick("sample.heic").setFormat("jpg").write("sample.jpg", function (err) { console.log("Finished saving", err); }); – Aneel Ansari Aug 01 '18 at 05:43
  • 1
    Perfectly on topic question. Still relevant 2 years later. The stackoverflow "rule" about library recommendations needs to be policed with a little more reasonableness. This is not likely to provoke the "religious" debate of "should I use Angular or React", and since most programming problems are solved with libraries, somebody here needs to lighten up. – Greg Woods Aug 12 '20 at 19:39
  • CloudConvert supports to convert these HEIC files to JPG: https://cloudconvert.com/heic-to-jpg. They also have an [API](https://cloudconvert.com/api/convert/heic-to-jpg) with PHP/node.js/Python SDKs. – monday Sep 21 '17 at 09:48
  • Wish they would open source it :) – Christian Sep 22 '17 at 12:42

3 Answers3

22

It's complicated because iOS 11 is actually storing tiles of HEVC encoded images in a HEIF container, but there's a demo using the nokia lib to extract them all, ffmpeg to decode them and then stitching them into a single jpeg with imagemagick in the heiftest repo linked from corrupted HEIC tile when converting to JPEG

We also have a working one you can use by cloning https://github.com/pushd/heif and then:

cmake CMakeLists.txt && make && Bins/heiftojpeg test_001.heic test_001.jpg
Eric Jensen
  • 329
  • 1
  • 3
  • This is kind of like we do it today. An upvote for you! – Christian Sep 22 '17 at 11:13
  • I get `terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 853) >= this->size() (which is 853) Aborted (core dumped)` when I run it. – Petah Sep 28 '17 at 04:33
  • This looks like a good solution, but I can't get it to build. I get "/path/to/heif/Srcs/common/iteminfobox.hpp:105:5: error: unused parameter ‘itemInfoEntry’ [-Werror=unused-parameter]" – Tom Kincaid Oct 17 '17 at 14:03
  • 1
    https://github.com/monostream/tifig would be an alternative, and it is a bit faster than pushd/heif – Flask Nov 09 '17 at 10:45
0

CloudConvert supports to convert these HEIC files to JPG: https://cloudconvert.com/heic-to-jpg. They also have an API with PHP/node.js/Python SDKs.

monday
  • 313
  • 2
  • 3
-2

There is no such library available right now for image conversion on a server for HEIF to JPEG, ImageMagick doesn't have support for that till now.

The only way you can do this by exporting your images from your device, that should produce a JPEG image.

Nokia has a HEIF reader javascript implementation which you can have a look at: Nokiatech heif

Alternate: You can try this website if this works.

Feature Request for ImageMagick

bhansa
  • 6,166
  • 2
  • 23
  • 42