We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a630613 commit f3ff3f8Copy full SHA for f3ff3f8
1 file changed
shell.rb
@@ -0,0 +1,22 @@
1
+# array for base filenames
2
+base_names = []
3
+
4
+# change into image directory
5
+Dir.chdir("image_batch")
6
7
+# collect all base filenames
8
+Dir["*.png"].map{|file| base_names << file.split('.').first}
9
10
+# using system call
11
+# 'magick' here is a version 7+ option, previous versions would be just 'convert'
12
+base_names.map {|file| system("magick convert #{file}.png #{file}.jpg")}
13
14
+# option: using mini_magick
15
+#base_names.each do |file|
16
+ #image = MiniMagick::Image.open("#{file}")
17
+ #image.format "jpg"
18
+ #image.write("#{file.split('.').first}.jpg")
19
+#end
20
21
+# list all of the files in the image directory
22
+Dir["*"].map{|file| puts file}
0 commit comments