Last Updated: February 25, 2016
·
1.25K
· mokagio

One line png to jpg entire folder with Ruby and ImageMagik

Given that you have ImageMagick and Ruby on your machine, open the terminal, cd in the folder, open the Ruby console with irb and type:

Dir['*.png'].each { |img| system "convert #{img} #{img.gsub(File.extname(img), '.jpg')}" }

This snippet is easily customizable to more advanced needs, but the more stuff you need to do, the uglier it gets to do it in one line...