Last active
October 1, 2020 17:24
-
-
Save Pauloparakleto/8a0b533837a45eb842180f9243cf394b to your computer and use it in GitHub Desktop.
Tired opening many images, convert it to jpg before sharing it with your friends? This ruby script use minimagick to read images and write it where you want. In general, the file name has a base like "IMG" + "(n+1)". Thus the script auto increment the last part, convert and write the correspondent name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mini_magick' | |
#Criar script IMG_#{numero + 1} for each loop | |
initial_number = 3746 | |
final_number = 3774 | |
image_name = "" | |
image_name_converted = "" | |
while initial_number < final_number | |
initial_number = initial_number + 1 | |
p image_name = "IMG_" + "#{initial_number}" + ".CR2" | |
p image_name_converted = "IMG_" + "#{initial_number}" + ".jpg" | |
image = MiniMagick::Image.open("C:/path/to/open/#{image_name}") | |
p image.path | |
image.write("C:/path/to/write/#{image_name_converted}") | |
p "Image converted and saved at C:/Users/alpar/Desktop/paulo_e_louis_jpg/" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment