+ def convert_image_format(self, filename, format='BMP', allowAlpha=False, extension='.bmp'):
+ """Convert the image to another format, and store it in a local place"""
+ if not os.path.exists(filename):
+ logger.warn('The input file "%s" does not exist, so it will not be converted', filename)
+ return filename, False
+ if PIL is None:
+ logger.warn('PIL could not be found, not converting image format')
+ return filename, False
+
+ self.remove_old_image_cache()
+ output_name = os.path.join(self._ConvertedWallpaperLocation, '%s%s' % (time.time(), extension))
+ img = PIL.Image.open(filename)
+
+ # Remove the alpha channel if the user doens't want it
+ if not allowAlpha and img.mode == 'RGBA':
+ img = img.convert('RGB')
+ img.save(output_name, format)
+
+ return output_name, True
+
+
+class XLoadImageChanger(BaseChanger):
+ name = "xloadimage"
+ _ConvertedWallpaperLocation = '/tmp/wallpapers_xloadimage/'