def addFile(self, relPath, fullPath): """Adds the specific file to the sprite packer.""" fileType = relPath.split('.')[-1] if fileType not in self.types: raise Exception('Unsupported image format: %s' % fileType) # Load image and grab required information img = ImgInfo(fullPath) width, height = img.getSize() checksum = img.getChecksum() self.files.append(SpriteFile(width, height, relPath, fullPath, checksum)) Console.debug('- Found image "%s" (%dx%dpx)' % (relPath, width, height))
def __collectImages(self): """ Stores __images as { dirName : { assetName : [projectObj, imageWidth, imageHeight] }} """ images = {} assets = self.__assets for name in assets: # white list matching if not name.endswith((".png", ".jpeg", ".jpg", ".gif")): continue resdir = dirname(name) if not resdir in images: images[resdir] = {} entry = assets[name] info = ImgInfo(entry["path"]).getInfo() if info is None: raise Exception("Invalid image: %s" % name) images[resdir][basename(name)] = [ entry["project"], info[0], info[1] ] self.__images = images
def addFile(self, relPath, fullPath): """Adds the specific file to the sprite packer.""" fileType = relPath.split('.')[-1] if fileType not in self.types: raise Exception('Unsupported image format: %s' % fileType) # Load image and grab required information img = ImgInfo(fullPath) width, height = img.getSize() checksum = img.getChecksum() self.files.append( SpriteFile(width, height, relPath, fullPath, checksum)) Console.debug('- Found image "%s" (%dx%dpx)' % (relPath, width, height))
def addFile(self, relPath, fullPath): """Adds the specific file to the sprite packer.""" fileType = relPath.split('.')[-1] if fileType not in self.types: raise Exception('Unsupported image format: %s' % fileType) # Load image and grab required information img = ImgInfo(fullPath) w, h = img.getSize() checksum = img.getChecksum() del img # TODO crop transparent "borders" # TODO allow for rotation self.files.append(SpriteFile(w, h, relPath, fullPath, checksum)) Console.debug('- Found image "%s" (%dx%dpx)' % (relPath, w, h))
def addFile(self, relPath, fullPath): """Adds the specific file to the sprite packer.""" fileType = relPath.split(".")[-1] if fileType not in self.types: raise Exception("Unsupported image format: %s" % fileType) # Load image and grab required information img = ImgInfo(fullPath) w, h = img.getSize() checksum = img.getChecksum() del img # TODO crop transparent "borders" # TODO allow for rotation self.files.append(SpriteFile(w, h, relPath, fullPath, checksum)) debug('- Found image "%s" (%dx%dpx)' % (relPath, w, h))