Rewrite tools about mergeData and compressImg in main.rb by ruby.