{"id":8632,"date":"2018-09-07T14:56:44","date_gmt":"2018-09-07T21:56:44","guid":{"rendered":"http:\/\/www.yuleshow.com\/?p=8632"},"modified":"2018-09-07T14:56:44","modified_gmt":"2018-09-07T21:56:44","slug":"a-full-solution-for-heif-and-ubuntu","status":"publish","type":"post","link":"https:\/\/www.yuleshow.com\/?p=8632","title":{"rendered":"A full solution for HEIF and Ubuntu"},"content":{"rendered":"<p>The HEIF(HEIC) format is short for High Efficient Image Format which is introduced by Apple with iOS 11. It uses the new methodology to store image files only one third the size than JPEG with the same quality.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8645\" src=\"https:\/\/www.yuleshow.com\/images\/oldwpmedia\/2018\/09\/IMG_0527-1.png\" alt=\"IMG_0527.PNG\" width=\"1123\" height=\"619\" \/><br \/>\nNow the iOS 11 provides the options for users to select either HEIF format or the old way JPEG in the Camera Setting. Also, iOS has another option for users to choose is under Photo Setting, which is the output formats for Mac or Windows. Once the user selects this option to Automatic, iPhone will automatically transfer HEIC files under Mac and JPG files under Windows.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8646\" src=\"https:\/\/www.yuleshow.com\/images\/oldwpmedia\/2018\/09\/IMG_0528-1.png\" alt=\"IMG_0528.PNG\" width=\"1123\" height=\"564\" \/><br \/>\nBut how about Ubuntu\/Linux?<br \/>\nThe answer is upset since the Mac is based on Unix itself, the iOS device will recognize the Ubuntu\/Linux system as a Mac computer. The output is only HEIC for the image files, at least under Ubuntu 18.04.<br \/>\nIs that any way to CHEAT the iOS and make it thinks Ubuntu as a Windows system instead of Mac? So far, I didn&#8217;t find any way for almost two months of studying.<br \/>\nActually, it happened before, sometimes I can use the Shotwell to import the images on iPhone and the format is JPEG. But the computer can&#8217;t recognize the iPhone every time, or the images can&#8217;t be transferred every time. This is not what I want.<br \/>\nI even installed 17.04 and 17.10 to do the test, once I can guarantee the connection is built I lost the chance to have JPEG files on the device. It will stick on HEIC format under DCIM folder.<br \/>\nNo any photo viewer\/organizer under Ubuntu support HEIC yet. It looks that the only way is transferring the files with HEIC format and covert them afterward. Only some command line tools can covert HEIC to JPEG individually.<br \/>\nLet&#8217;s solve it, RnR.<br \/>\nFirstly, a brand clean Ubuntu 18.04 with the default installation. After reboot,<\/p>\n<pre>sudo apt update\nsudo apt upgrade\n<\/pre>\n<p>to upgrade the system to the newest status.<br \/>\nSecondly, install the tools to connect the iPhone.<\/p>\n<pre>sudo apt install libimobiledevice-utils<\/pre>\n<p>After installation, pair the iPhone, it had to be done twice every time.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8635\" src=\"https:\/\/www.yuleshow.com\/images\/oldwpmedia\/2018\/09\/idevicepair.png\" alt=\"idevicepair\" width=\"797\" height=\"237\" \/><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8642\" src=\"https:\/\/www.yuleshow.com\/images\/oldwpmedia\/2018\/09\/IMG_0529-1.png\" alt=\"IMG_0529\" width=\"847\" height=\"499\" \/><br \/>\nThen create a mount point for iPhone, I use \/media\/iPhone, this is only needed once.<\/p>\n<pre>sudo mkdir \/media\/iPhone\nsudo chown yuleshow:yuleshow \/media\/iPhone\n<\/pre>\n<p>The last one is to assign the point to myself (yuleshow).<br \/>\nNow, install the mount tool.<\/p>\n<pre>sudo apt install ifuse<\/pre>\n<p>Then mount by:<\/p>\n<pre>ifuse \/media\/iPhone<\/pre>\n<p>Up to now, the iPhone was successfully mounted to the Ubuntu. I can use the file browser to open the DCIM folder, which contains the images and videos. Every folder basically has 1,000 files but varies after modification and HDR on the phone.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8634\" src=\"https:\/\/www.yuleshow.com\/images\/oldwpmedia\/2018\/09\/mount.png\" alt=\"mount\" width=\"702\" height=\"415\" \/><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8647\" src=\"https:\/\/www.yuleshow.com\/images\/oldwpmedia\/2018\/09\/copying-1.png\" alt=\"copying.png\" width=\"445\" height=\"125\" \/><br \/>\nThe big thing comes, compile:<br \/>\nAgain, firstly for compiling I need install the tools:<\/p>\n<pre>sudo apt install cmake\nsudo apt install git\n<\/pre>\n<p>Then install the required ffmpeg and the libraries by<\/p>\n<pre>sudo apt install ffmpeg<\/pre>\n<p>and<\/p>\n<pre>sudo add-apt-repository -y ppa:jonathonf\/ffmpeg-3\nsudo apt-get update\nsudo apt-get install libavcodec-dev libswscale-dev<\/pre>\n<p>Make an empty folder (following command without the folder creation) and compile the vips under it:<\/p>\n<pre>sudo apt-get install build-essential pkg-config libglib2.0-dev libexpat1-dev libjpeg-dev libexif-dev libpng-dev libtiff-dev\nwget https:\/\/github.com\/jcupitt\/libvips\/releases\/download\/v8.6.1\/vips-8.6.1.tar.gz\ntar xzf vips-8.6.1.tar.gz\ncd vips-8.6.1\n.\/configure\nmake\nsudo make install\n<\/pre>\n<p>Make another empty folder (following command without the folder creation) to compile tifig within the folder<br \/>\nmake another empty folder<\/p>\n<pre>git clone --recursive https:\/\/github.com\/monostream\/tifig.git\nmkdir tifig\/build &amp;&amp; cd tifig\/build\ncmake ..\nmake\n<\/pre>\n<p>Then copy tifig to \/usr\/local\/bin, now I have the covert tool tifig but still can&#8217;t batch do the conversion.<br \/>\nperl is here, I created the following perl script and also chmod and put under \/usr\/local\/bin as heictojpeg without file extension.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8636\" src=\"https:\/\/www.yuleshow.com\/images\/oldwpmedia\/2018\/09\/perlbatch.png\" alt=\"perlbatch.png\" width=\"797\" height=\"306\" \/><\/p>\n<pre>heictojpeg<\/pre>\n<p>under any folder contains HEIC will automatically convert all the HEIC files to JPEG.<br \/>\nBingo!<br \/>\n&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The HEIF(HEIC) format is short for High Efficient Image Format which is introduced by Apple with iOS 11. It uses the new methodology to store image files only one third the size than JPEG with the same quality. Now the iOS 11 provides the options for users to select either HEIF format or the old [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[43,44],"tags":[],"class_list":["post-8632","post","type-post","status-publish","format-standard","hentry","category-linux","category-mac-ios"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=\/wp\/v2\/posts\/8632","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8632"}],"version-history":[{"count":0,"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=\/wp\/v2\/posts\/8632\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8632"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yuleshow.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}