LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-03-2018, 02:07 PM   #1
philanc
Member
 
Registered: Jan 2011
Posts: 180

Rep: Reputation: 147Reputation: 147
access to .heic image files


Hi all,

It looks like recent iPhones now produce photos with a new encoding (HEIF, stored in HEIC containers) instead of the well-known JPEG...

I have found and used a nice (and currently free) online converter at https://heictojpg.com/

I am looking for a command line tool (or at least a library) which allows me to convert a batch of .heic files to jpeg. Any suggestion?

TIA

Phil

Last edited by philanc; 03-03-2018 at 03:27 PM.
 
Old 03-03-2018, 03:45 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 17,825

Rep: Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401Reputation: 2401
I just went through this exercise recently and did not have much luck. Although Imagemagick states on their web site that it supports HEIC it didn't work. I gave up since it was less work for someone with a Mac to convert the files for me. I don't have a IPhone but would probably set the default to jpeg just so you don't mess with conversion.
 
1 members found this post helpful.
Old 03-03-2018, 06:25 PM   #3
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 5,508

Rep: Reputation: 3255Reputation: 3255Reputation: 3255Reputation: 3255Reputation: 3255Reputation: 3255Reputation: 3255Reputation: 3255Reputation: 3255Reputation: 3255Reputation: 3255
I don't have any HEIF images to test with, but I did find these few projects that might do it.

https://github.com/monostream/tifig - requires ffmpeg 3.1+ and libvips 8.6+. SBo has ffmpeg 3.2.4 but only libvips 8.1, so you may be able to manually use a newer version of libvips.

https://github.com/ImageMagick/ImageMagick/ - According to the changelog, v7 should have it from v7.0.7-22+ and v6 should have it from v6.9.9-34.

https://github.com/pushd/heif - According to the readme, it requires ffmpeg and imagemagick, however, it doesn't state what versions of each.
 
1 members found this post helpful.
Old 03-03-2018, 07:44 PM   #4
philanc
Member
 
Registered: Jan 2011
Posts: 180

Original Poster
Rep: Reputation: 147Reputation: 147
Thanks, michaelk and bassmadrigal, for your answers. I think that ImageMagick is the best bet.

I built the last github version with configure option '--with-heic'.

Libde265 must be installed, or ImageMagick configure builds with no heic support.
so I built and installed the last version at https://github.com/strukturag/libde265.

Now, ImageMagick says it builds with HEIC.
- when I run './magick --version', it lists heic in the built-in delegates list.
Code:
./magick --version
Version: ImageMagick 7.0.7-25 Q16 x86_64 2018-03-03 http://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI OpenMP 
Delegates (built-in): bzlib djvu fftw fontconfig freetype heic jng jp2 jpeg lcms lzma openexr pangocairo png raw tiff wmf x xml zlib
'identify zz.heic' (with some zz.heic photo), identifies it correctly as a HEIC image.

'convert zz.heic zz.jpeg' does convert to a jpeg image. (woohoo!)

'convert zz.jpeg zz2.heic' fails with message "no encode delegate for this image format `HEIC'"

So maybe I missed something to also allow HEIC encoding... but for the moment, I don't care. I think that for many of us, the HEIC to JPEG conversion is much more useful!

Hope it helps some of you with the same issue

(and I sure hope the next Slackware will include libde265 and ImageMagick with heic support)

Phil
 
Old 04-10-2018, 10:23 PM   #5
cparke
LQ Newbie
 
Registered: Apr 2018
Posts: 3

Rep: Reputation: Disabled
libde265

Quote:
Originally Posted by philanc View Post
Libde265 must be installed, or ImageMagick configure builds with no heic support.
so I built and installed the last version at GITHUB ...
I'm trying to do this, too! With Ubuntu, however. The problem is, the Makefile for libde265 does not provide an 'install' method, so how did you do it? To work with the ImageMagick build system, the package must be registered as installed somehow. While I built the library successfully, ImageMagick still does not include HEIC because it doesn't see the package as available!

This is a simple problem somebody who knows more about the pkg-config utility and libde265 can probably answer? Help needed here please.
 
Old 04-12-2018, 02:04 PM   #6
cparke
LQ Newbie
 
Registered: Apr 2018
Posts: 3

Rep: Reputation: Disabled
libde265

Just an update for others --- I did get libde265 properly installed. The "trick" was to ignore the instructions in the README.md file about using cmake to generate the make in a 'build' subdirectory; if you do it this way, you'll run into my problem of there being no 'install' operation in the Makefile. Instead, I just used the Makefile that was in the main directory, it built somewhat differently there but there also is an 'install' action in that Makefile.

Once libde265 is installed, the ImageMagick configure enables support for heic file format and it all works as was described. I let it install both libde265.so and ImageMagick into /usr/local, though I'm told they more appropriately belong in /opt. Whatever... I just also had to add /usr/local/lib into my LD_LIBRARY_PATH for magick to find the shared library.

Also, Ubuntu actually includes an ImageMagick package in its repositories, but it is ImageMagick 6 and does not have HEIC built-in. That package is also used as a dependency by CUPS for printer services, however, so I had keep that installed too!

Finally, I'd mention that not all HEIC converters are the same. Some strip the image information headers with things like the date/time take and geolocation, and file size of the resulting JPG seem to vary (I guess that's a compression quality issue?) I think everyone has to get with the program, GIF BMP JPG have a new sibling HEIC that needs to be universally adopted; the time has come ...
 
Old 04-13-2018, 01:07 AM   #7
philanc
Member
 
Registered: Jan 2011
Posts: 180

Original Poster
Rep: Reputation: 147Reputation: 147
Quote:
Originally Posted by cparke View Post
I'm trying to do this, too! With Ubuntu, however. The problem is, the Makefile for libde265 does not provide an 'install' method, so how did you do it? To work with the ImageMagick build system, the package must be registered as installed somehow. While I built the library successfully, ImageMagick still does not include HEIC because it doesn't see the package as available!
Quote:
Originally Posted by cparke View Post
Just an update for others --- I did get libde265 properly installed. The "trick" was to ignore the instructions in the README.md file about using cmake to generate the make in a 'build' subdirectory; if you do it this way, you'll run into my problem of there being no 'install' operation in the Makefile. Instead, I just used the Makefile that was in the main directory,
Yes I ran into the same issue. I built libde265 in a user directory with ./configure / make.
Then before ./configuring ImageMagick, I just hand-copied the libde265.so files in a system dir --Not as clean as your /usr/local complete install, but it did the job!

Last edited by philanc; 04-13-2018 at 01:07 AM. Reason: typo
 
Old 04-13-2018, 08:15 AM   #8
cparke
LQ Newbie
 
Registered: Apr 2018
Posts: 3

Rep: Reputation: Disabled
Quote:
Originally Posted by philanc View Post
I just hand-copied the libde265.so files in a system dir --Not as clean as your /usr/local complete install, but it did the job!
Really? I had tried that, but it didn't help, because ImageMagick's ./configure isn't searching for the .so shared library, it's searching for the package! For that to detect, a separate .pc file must be generated and copied into the proper system directory where the other .pc files are located. That's why I was fretting...
 
Old 04-13-2018, 08:37 AM   #9
bassplayer69
Member
 
Registered: Jul 2007
Location: In a van down by the river...
Distribution: Linux Mint 19 & Slackware64-Current
Posts: 220

Rep: Reputation: 49
If you have a newer iPhone, you have the format automatically converted to .jpg on export:

http://osxdaily.com/2017/09/29/chang...mat-jpeg-heif/
 
Old 04-14-2018, 01:56 AM   #10
philanc
Member
 
Registered: Jan 2011
Posts: 180

Original Poster
Rep: Reputation: 147Reputation: 147
Quote:
Originally Posted by cparke View Post
Really? I had tried that, but it didn't help, because ImageMagick's ./configure isn't searching for the .so shared library, it's searching for the package! For that to detect, a separate .pc file must be generated and copied into the proper system directory where the other .pc files are located. That's why I was fretting...
You are right. I copied the libde265.so, .a, .la files in /usr/lib64 and also the libde265.pc file to /usr/lib64/pkgconfig (and forgot about the .pc file in my last post). libde265.pc is generated by running ./configure.
 
Old 04-14-2018, 02:02 AM   #11
philanc
Member
 
Registered: Jan 2011
Posts: 180

Original Poster
Rep: Reputation: 147Reputation: 147
Quote:
Originally Posted by bassplayer69 View Post
If you have a newer iPhone, you have the format automatically converted to .jpg on export:
If I happen to have an iphone, I will consider this option (although heic files are more compact). But I do not control how other people do configure their iphone and the photos they send me...
 
Old 05-18-2018, 08:20 PM   #12
dstan2
LQ Newbie
 
Registered: May 2018
Posts: 3

Rep: Reputation: Disabled
I'm trying to do this on Amazon Linux (I'm building Imagemagick for AWS Lambda), but am having trouble at the `configure` stage.
I'm Installing libde265 from the github source, copying the libde265.so, .a, .la files to /usr/lib64 and libde265.pc file to /usr/lib64/pkgconfig as mentioned above, and configuring Imagemagick with the --with-heic flag, but I still don't get the HEIC delegate in the config output. Any ideas about steps I'm missing or options I'm leaving out? I've been stumped for a week.


This is my whole setup process:
Quote:
sudo yum install git -y
sudo yum group install "Development Tools" -y
git clone https://github.com/strukturag/libde265.git
cd libde265/
bash autogen.sh
./configure --disable-dec265 --disable-sherlock265
make
sudo make install
sudo cp /usr/local/lib/libde265.a /usr/lib64/libde265.a
sudo cp /usr/local/lib/libde265.so /usr/lib64/libde265.so
sudo cp /usr/local/lib/libde265.so.0.0.10 /usr/lib64/libde265.so.0.0.10
sudo cp /usr/local/lib/libde265.la /usr/lib64/libde265.la
sudo cp /usr/local/lib/libde265.so.0 /usr/lib64/libde265.so.0
sudo cp /usr/local/lib/pkgconfig/libde265.pc /usr/lib64/pkgconfig/libde265.pc
sudo cp -r /usr/local/include/libde265 /usr/include
cd ..

sudo yum -y install libpng-devel libjpeg-devel libtiff-devel gcc
curl -O http://www.imagemagick.org/download/ImageMagick.tar.gz
tar zxvf ImageMagick.tar.gz
cd ImageMagick
./configure --prefix=/var/task/imagemagick --enable-shared=no --enable-static=yes --with-heic=yes
 
Old 05-21-2018, 02:52 AM   #13
MigoDen
LQ Newbie
 
Registered: May 2018
Posts: 1

Rep: Reputation: Disabled
Quote:
Originally Posted by dstan2 View Post
cd ImageMagick
./configure --prefix=/var/task/imagemagick --enable-shared=no --enable-static=yes --with-heic=yes
take a look at config.log file, there will be something like

Quote:
configure:32300: checking for HEIF
configure:32307: $PKG_CONFIG --exists --print-errors "libheif"
configure:32310: $? = 0
configure:32324: $PKG_CONFIG --exists --print-errors "libheif"
configure:32327: $? = 0
configure:32365: result: yes
In case of error you will see an error in config.log file.

I've succeffuly built ImageMagic on Mac and Linux

Version: ImageMagick 7.0.7-33 Q16 x86_64 2018-05-18 https://www.imagemagick.org
Copyright: 1999-2018 ImageMagick Studio LLC
License: https://www.imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib freetype heic jng jpeg ltdl lzma png tiff xml zlib

But bear in mind that ImageMagic has far from superior heic->jpeg conversion algorithm, resulting images have a lot of artefacts, you can check image quality via service https://heic2jpeg.com/

Last edited by MigoDen; 05-21-2018 at 10:40 PM.
 
Old 07-03-2018, 03:25 PM   #14
janas03
LQ Newbie
 
Registered: Apr 2008
Location: Warsaw, Poland
Distribution: Slackware64 14.2
Posts: 29

Rep: Reputation: 4
I stumbled upon this issue yesterday when I wanted to crop&convert some pictures imported from iPhone device. Based on information in this thread and Internet sources I created few slackbuild scripts. If anyone is interested the url is click. I plan to submit libraries to SlackBuilds.org eventually.

Please note that the heic gimp plugin is only meant for gimp < 2.10. Version included in current has it out of the box.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
help cross platformt back up (not image need access to files not mount) rcorkum Linux - Newbie 4 12-06-2014 08:10 AM
Brother MFC-J280W Printer will only print image files, not text files, won't scan. bplis* Linux - Software 4 11-28-2011 09:34 AM
How to access ISO and other CD-image files? JCole123 Linux - Newbie 22 07-14-2010 10:13 AM
Image Viewer Can't View Image Files. klownska Linux - Software 1 02-27-2006 03:26 AM
Best image viewer for very large image files? andvaranaut Linux - Software 1 02-21-2004 11:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration