Closed zeke closed 2 years ago
For future travelers, I found another way with ImageMagick:
find . -name '*.HEIC' -exec mogrify -format jpg {} +
Usually, you get that error when the image is not a HEIC. file
seems to tell you it's a jpeg. Are you sure it is not a jpeg that has the wrong extension? That would not surprise me with Google takeout
Okay, I can confirm that the flower.heic
file uploaded to your repro repo in is fact a jpeg image. It just has the wrong format. You can find a good amount of folks complaining about this actually -- Google Photos will compress images uploaded to it (unless you specifically select "original quality" from the settings). When it does this compression, it converts the images to jpegs but still keeps the .heic
file extension on them, which just leads to a lot of confusion.
ImageMagick handles this as it will determine which codec to use to load the image entirely on its own. So with your command, it will see that the image being loaded is a jpeg, load it as a jpeg, and then re-encode it back to a jpeg to write the output. With your particular files (at least judging by flower.heic
which was provided as a sample, that's actually a bad idea. Re-encoding jpeg images leads to introducing more and more artifacts every time the image is encoded, leading to worse quality every time. The image you provided it already compressed to 86% of original quality. I would recommend that you do not re-encode these files. Simply rename them to a .jpg
file extension.
@catdad! Thank you for the thorough response! Very helpful.
I am now meagerly sponsoring you! In three to six months I will have bought you a coffee. 🙏🏼
Hi @catdad 👋🏼 🐈⬛
Human-dad here. Thanks for writing these modules. 🙏🏼
I"m trying to use
heic-convert
to convert a bunch of files exported from Google Photos with Google Takeout, but getting an errorinput buffer is not a HEIC image
.I created a repro repo here: https://github.com/zeke/heic-convert-test
Am I missing something obvious?