lib/kanoko/application/convert.rb in kanoko-0.3.1 vs lib/kanoko/application/convert.rb in kanoko-0.3.2
- old
+ new
@@ -113,19 +113,15 @@
else
["dst", ".#{to_ext}"]
end
Tempfile.create(dst_name) do |dst_file|
- system_command = [
- { "OMP_NUM_THREADS" => "1" },
- 'convert',
- '-depth', '8',
+ result = system *system_command(
convert_options,
"#{src_type}#{src_file.path}",
dst_file.path,
- ].flatten
- result = system *system_command
+ )
unless result
logger.error "command fail $?=#{$CHILD_STATUS.inspect}"
return 500
end
@@ -135,9 +131,21 @@
end
end
end
private
+
+ def system_command(options, src_path, dst_path)
+ [
+ { "OMP_NUM_THREADS" => "1" },
+ 'convert',
+ '-depth', '8',
+ '-background', 'none',
+ options,
+ src_path,
+ dst_path,
+ ].flatten
+ end
def http_get(uri)
retries = 2
req = Net::HTTP::Get.new(uri.request_uri)
http = Net::HTTP.new(uri.host, uri.port)