top | item 46361608

(no title)

michaelbryzek | 2 months ago

Ruby script on my PATH to use sips to convert to jpeg. I can cd to the directory and run "convert.rb" - will find all HEIC files and convert

    #!/usr/bin/env ruby
    
    def run(extension)
      files = `find . -type f -name "\*.#    {extension}"`.split("\n")
      files.each do |f|
        jpg = f.sub(/\.#{extension}/i, '.jpg')
        if !File.exist?(jpg)
          cmd = "sips -s format jpeg '#{f}' --out '#{jpg}'"
          `#{cmd}`
          puts cmd
        end
      end
    end

    run("HEIC")
    run("heic")

discuss

order

nine_k|2 months ago

If you have imagemagick installed:

  magick mogrify -format JPG *.heic *.HEIC