# File lib/mini_exiftool.rb, line 140
  def save
    return false if @changed_values.empty?
    @errors.clear
    temp_file = Tempfile.new('mini_exiftool')
    temp_file.close
    temp_filename = temp_file.path
    FileUtils.cp filename, temp_filename
    all_ok = true
    @changed_values.each do |tag, val|
      original_tag = MiniExiftool.original_tag(tag)
      arr_val = val.kind_of?(Array) ? val : [val]
      arr_val.map! {|e| convert e}
      tag_params = ''
      arr_val.each do |v|
        tag_params << %Q(-#{original_tag}="#{v}" )
      end
      opt_params = ''
      opt_params << (arr_val.detect {|x| x.kind_of?(Numeric)} ? '-n ' : '')
      opt_params << (@convert_encoding ? '-L ' : '')
      cmd = %Q(#@@cmd -q -P -overwrite_original #{opt_params} #{tag_params} "#{temp_filename}")
      result = run(cmd)
      unless result
        all_ok = false
        @errors[tag] = @error_text.gsub(/Nothing to do.\n\z/, '').chomp
      end
    end
    if all_ok
      FileUtils.cp temp_filename, filename
      reload
    end
    temp_file.delete
    all_ok
  end