# File lib/mini_magick.rb, line 154
      def create(ext = nil, validate = true, &block)
        begin
          tempfile = Tempfile.new(['mini_magick', ext.to_s.downcase])
          tempfile.binmode
          block.call(tempfile)
          tempfile.close

          image = self.new(tempfile.path, tempfile)

          if validate and !image.valid?
            raise MiniMagick::Invalid
          end
          return image
        ensure
          tempfile.close if tempfile
        end
      end