Convert alle HEIC files in a directory to PNG file
First off all you have to compile imagemagick from source with heic support and some other libs:
Here are the instructions for this:
cd /usr/src
sudo git clone https://github.com/strukturag/libde265.git
sudo git clone https://github.com/strukturag/libheif.git cd libde265/
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install
cd /usr/src/libheif/
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install
cd /usr/src/
sudo wget https://www.imagemagick.org/download/ImageMagick.tar.gz
sudo tar xf ImageMagick.tar.gz cd ImageMagick-7*
sudo ./configure --with-heic=yes
sudo make sudo make install
sudo ldconfig
if you want to convert all files in a directory to png from heic. For some reason mogrify from imagemagick refuses.
So I had to do it with convert:
for file in *.HEIC; do convert $file $file.PNG; done
The only drawback with convert is that it changes the date of the new files to the date of when they have been created,so this is the day you converted them. So this can be inconvenient.
You can set them back to the date you took the picture.
By reading the exif data of the original file and touching your png file with this date.
For this you can use this nice command:
for file in *.HEIC; do touch -t `identify -verbose $file | awk -F":" '/exif:DateTime:/{gsub(" ","",$0); print $3$4$5$6 ;}'` $file.PNG done;
First off all you have to compile imagemagick from source with heic support and some other libs:
Here are the instructions for this:
cd /usr/src
sudo git clone https://github.com/strukturag/libde265.git
sudo git clone https://github.com/strukturag/libheif.git cd libde265/
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install
cd /usr/src/libheif/
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install
cd /usr/src/
sudo wget https://www.imagemagick.org/download/ImageMagick.tar.gz
sudo tar xf ImageMagick.tar.gz cd ImageMagick-7*
sudo ./configure --with-heic=yes
sudo make sudo make install
sudo ldconfig
if you want to convert all files in a directory to png from heic. For some reason mogrify from imagemagick refuses.
So I had to do it with convert:
for file in *.HEIC; do convert $file $file.PNG; done
The only drawback with convert is that it changes the date of the new files to the date of when they have been created,so this is the day you converted them. So this can be inconvenient.
You can set them back to the date you took the picture.
By reading the exif data of the original file and touching your png file with this date.
For this you can use this nice command:
for file in *.HEIC; do touch -t `identify -verbose $file | awk -F":" '/exif:DateTime:/{gsub(" ","",$0); print $3$4$5$6 ;}'` $file.PNG done;
Reacties
Een reactie posten