summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-06-04 00:17:06 +0200
committerJulian T <julian@jtle.dk>2020-06-04 00:17:06 +0200
commit3afb0b28e0b28a365a92b2bb89a62ea98b8cc896 (patch)
treeb8cdc8cc408c7fa0b19878ca4c710c1f08a30780
parentbc844b1c0d5bf55c7d259c2dc56564eb731663df (diff)
Imagesize from command line
-rwxr-xr-xbuild.rb12
-rw-r--r--imginfo.yml1
2 files changed, 8 insertions, 5 deletions
diff --git a/build.rb b/build.rb
index 3e594b1..41b4388 100755
--- a/build.rb
+++ b/build.rb
@@ -9,6 +9,7 @@ require 'erb'
def copyimage(path, file, target)
hash = Digest::MD5.file(file).hexdigest
+ hash = Digest::MD5.hexdigest(hash.to_s + target)
filename = "#{hash}.jpg"
dest = File.join(path, filename)
@@ -41,11 +42,14 @@ OptionParser.new do |opts|
opts.on("-d", "--dest PATH", "PATH to put build files") do |path|
options[:path] = path
end
+ opts.on("-s", "--size SIZE", "Size to resize images to") do |size|
+ options[:size] = size
+ end
end.parse!
-if !options[:path]
- options[:path] = "build"
-end
+options[:path] = "build" unless options[:path]
+options[:size] = "1920x1080" unless options[:size]
+puts options
# Create build dir
FileUtils.mkdir_p(options[:path])
@@ -60,7 +64,7 @@ defs["groups"].each do |key, value|
# For each image inside group
forImgs(value["imgs"]) do |img|
puts "Converting file #{img}"
- dest = copyimage(options[:path], img, defs["target"])
+ dest = copyimage(options[:path], img, options[:size])
files[img] = dest
end
diff --git a/imginfo.yml b/imginfo.yml
index e8dba0b..7010fe5 100644
--- a/imginfo.yml
+++ b/imginfo.yml
@@ -1,4 +1,3 @@
-target: 1920x1080
groups:
Flowering tree:
imgs: blomster.jpg