Use MiniMagick library and eliminate shell out.