def do_first(self):
        """Load generator, set size.

        We take the generator module name from self.srcfile so that
        this manipulator will work with different generators in a
        similar way to how the ordinary generators work with
        different images
        """
        # Load generator module and create instance if we haven't already
        if (not self.srcfile):
            raise IIIFError(text=("No generator specified"))
        if (not self.gen):
            try:
                (name, ext) = os.path.splitext(self.srcfile)
                (pack, mod) = os.path.split(name)
                module_name = 'iiif.generators.' + mod
                try:
                    module = sys.modules[module_name]
                except KeyError:
                    self.logger.debug(
                        "Loading generator module %s" % (module_name))
                    # Would be nice to use importlib but this is available only
                    # in python 2.7 and higher
                    pack = __import__(module_name)  # returns iiif package
                    module = getattr(pack.generators, mod)
                self.gen = module.PixelGen()
            except ImportError:
                raise IIIFError(
                    text=("Failed to load generator %s" % (str(self.srcfile))))
        (self.width, self.height) = self.gen.size
Load generator, set size.

        We take the generator module name from self.srcfile so that
        this manipulator will work with different generators in a
        similar way to how the ordinary generators work with
        different images