Help with heic files

Discussion in 'all things UNIX' started by fblais, Apr 24, 2025 at 8:54 PM.

  1. fblais

    fblais Registered Member

    Hi.
    I have an heic image file which I know has 16 images inside.
    I want to "extract" the content into individual files in jpg format, in some batch processing.
    I'm trying with imagemagick on the command-line but only get the first image.
    Can someone please tell me the correct command-line syntax?

    example of the last thing I tried:
    convert *.heic[0-15] *.jpg

    Thanks!
     
  2. FanJ

    FanJ Updates Team

  3. fblais

    fblais Registered Member

    Thanks, I'll check that one!
     
  4. fblais

    fblais Registered Member

    This was not helpful.
    However, this worked:

    for file in *.heic; do heif-convert $file ${file/%.heic/.jpg}; done

    I'm not sure if heif-convert is part of Imagemagick though.
    It probably comes from package libheif-examples instead.
     
  5. nicolaasjan

    nicolaasjan Registered Member

    My script is a bit different:
    Code:
    for i in *.heic; do heif-convert -q 100 "${i}" "${i%.heic}.jpg"; done
    (less compression in the jpg)
     
  6. fblais

    fblais Registered Member

  7. nicolaasjan

    nicolaasjan Registered Member

    And for Windows (bat file):
    Code:
    @echo off
    for %%f in (*.heic) do (
        echo Converting %%f to %%~nf.jpg
        heif-convert -q 100 "%%f" "%%~nf.jpg"
    )
    Ensure heif-convert.exe is installed and in the system's PATH.

    I have no idea where to get a recent compiled executable for Windows. Maybe compile from source?
    There is a rather old one here.

    I do know that IrfanView with plugins can batch convert them, but you also have to install the necessary “HEIF Image Extensions” and “HEVC Video Extensions” MS Store Apps.
    The HEVC extension is not free any more, except when you go to the store via this direct link:
    Code:
    ms-windows-store://pdp/?ProductId=9n4wgh0z6vhq
    .
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice