Converting files HEIC to png/jpg or MOV to png/jpg

If you got one or two files, just use an online converter…

however, if you have several hundred files you wish to convert, use imagemagick.

You first need to install it… on OSX, use homebrew.

$> brew install imagemagick.

this will give you the “convert” command in the command prompt.

Now, to do it manually from the command prompt, you’d go:

$> convert input.HEIC output.png

That will convert your HEIC and make a png version of it. Your original is left alone.

Now, if you have a batch of them… that’s another story… The lovely wife chose to print out a few hundred photos… so I had to go over “live” photos (MOV), and HEIC images, to be sent to Costco photo lab… they don’t do MOV/HEIC… so I have to convert them first.

wrote a quick script, php…

<?php
/** HEIC to png. */
$extension = ".HEIC";
$files = glob("*" . $extension);
foreach($files as $filename){

	$basename = basename($filename, $extension);

	echo "converting $filename...";
	`convert "{$filename}" "{$basename}.png"`;
	echo PHP_EOL;
}

here’s one for MOV. Taking the first frame.

<?php
/** MOV to png, first frame */
$extension = ".MOV";
$files = glob("*" . $extension);
foreach($files as $filename){

	$basename = basename($filename, $extension);

	echo "converting $filename...";
	`convert "{$filename}"[1] "{$basename}.png"`;
	echo PHP_EOL;


}


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *