Apply a series of actions from a set of (action, arg) tuples, probably
        as parsed from a URL. Each action is a code into PROCESSORS.

        Then save the mogrified image.

def save(self):
        """
        Apply a series of actions from a set of (action, arg) tuples, probably
        as parsed from a URL. Each action is a code into PROCESSORS.

        Then save the mogrified image.
        """
        from settings import PROCESSORS
        from .filesystem import makedirs

        if self.im is None:
            # If we got here something very strange is going on that I can't even
            # predict.
            return  # pragma: no cover
        makedirs(self.output_path)
        for action, arg in self.actions:
            action = PROCESSORS[action]
            if self.frames:
                new_frames = []
                for frame in self.frames:
                    new_frames.append(action.process(frame, arg))
                self.frames = new_frames
            else:
                self.im = action.process(self.im, arg)

        self.im = optimize.optimize(self.im, fmt=self.format, quality=self.quality)

        kwargs = {
            'format': self.format,
            'optimize': True,
            'quality': self.quality,
        }
        if self.format == 'jpeg':
            kwargs['progressive'] = True

        if self.filename.startswith('s3://'):
            import cStringIO
            from filesystem import s3
            output = cStringIO.StringIO()
            if self.frames:
                images2gif.write_gif(output, self.frames)
            else:
                self.im.save(output, **kwargs)
            output.reset()
            s3.put_file(output, self.filename)
        else:
            if self.frames:
                images2gif.write_gif(self.filename, self.frames)
            else:
                self.im.save(self.filename, **kwargs)