LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   access to .heic image files (https://www.linuxquestions.org/questions/slackware-14/access-to-heic-image-files-4175624871/)

philanc 03-03-2018 01:07 PM

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

michaelk 03-03-2018 02:45 PM

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.

bassmadrigal 03-03-2018 05:25 PM

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.

philanc 03-03-2018 06:44 PM

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

cparke 04-10-2018 09:23 PM

libde265
 
Quote:

Originally Posted by philanc (Post 5826998)
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.

cparke 04-12-2018 01:04 PM

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 ...

philanc 04-13-2018 12:07 AM

Quote:

Originally Posted by cparke (Post 5841696)
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 (Post 5842450)
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! :)

cparke 04-13-2018 07:15 AM

Quote:

Originally Posted by philanc (Post 5842603)
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...

bassplayer69 04-13-2018 07:37 AM

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/

philanc 04-14-2018 12:56 AM

Quote:

Originally Posted by cparke (Post 5842678)
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.

philanc 04-14-2018 01:02 AM

Quote:

Originally Posted by bassplayer69 (Post 5842682)
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...

dstan2 05-18-2018 07:20 PM

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

MigoDen 05-21-2018 01:52 AM

Quote:

Originally Posted by dstan2 (Post 5856547)
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/

janas03 07-03-2018 02:25 PM

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.

jefro 07-16-2021 02:32 PM

Any improvements to heic in linux?
 
Gimp, ffmpeg, magick on my Clear Linux still fail to be usable.

Any other non-building type solutions?


All times are GMT -5. The time now is 07:27 PM.