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...
Written by Giovanni Lodi
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#