class ImageProcessing::Pipeline

def handle_destination

deleted in case an exception is raised on saving the image.
empty destination file they created, so this method makes sure it is
In case of processing errors, both libvips and imagemagick will leave the
def handle_destination
  destination_existed = File.exist?(destination)
  yield
rescue
  File.delete(destination) if File.exist?(destination) && !destination_existed
  raise
end