def to_glyphs_background_image(self, ufo_glyph, layer):
ufo_image = ufo_glyph.image<EOL>if ufo_image.fileName is None:<EOL><INDENT>return<EOL><DEDENT>image = self.glyphs_module.GSBackgroundImage()<EOL>image.path = ufo_image.fileName<EOL>image.transform = Transform(*ufo_image.transformation)<EOL>if CROP_KEY in ufo_glyph.lib:<EOL><INDENT>x, y, w, h = ufo_glyph.lib[CROP_KEY]<EOL>image.crop = Rect(Point(x, y), Size(w, h))<EOL><DEDENT>if LOCKED_KEY in ufo_glyph.lib:<EOL><INDENT>image.locked = ufo_glyph.lib[LOCKED_KEY]<EOL><DEDENT>if ALPHA_KEY in ufo_glyph.lib:<EOL><INDENT>image.alpha = ufo_glyph.lib[ALPHA_KEY]<EOL><DEDENT>layer.backgroundImage = image<EOL>
Copy the background image from the UFO Glyph to the GSLayer.