Example #1
0
 def process_image(self, data):
     if not self.process_images:
         return data
     if self.opts.mobi_keep_original_images:
         return mobify_image(data)
     else:
         return rescale_image(data, png2jpg=self.opts.image_png_to_jpg,
                         graying=self.opts.graying_image)
Example #2
0
 def process_image(self, data):
     if not self.process_images or self.opts.process_images_immediately:
         return data
     if self.opts.mobi_keep_original_images:
         return mobify_image(data)
     else:
         return rescale_image(data, png2jpg=self.opts.image_png_to_jpg,
                         graying=self.opts.graying_image,
                         reduceto=self.opts.reduce_image_to)
Example #3
0
def process_image(data, opts):
    try:
        if not opts or not opts.process_images or not opts.process_images_immediately:
            return data
        elif opts.mobi_keep_original_images:
            return mobify_image(data)
        else:
            return rescale_image(data, png2jpg=opts.image_png_to_jpg,
                            graying=opts.graying_image)
    except Exception:
        return None
Example #4
0
 def process_image(self, data, opts):
     try:
         if not opts or not opts.process_images or not opts.process_images_immediately:
             return data
         elif opts.mobi_keep_original_images:
             return mobify_image(data)
         else:
             return rescale_image(data, png2jpg=opts.image_png_to_jpg,
                             graying=opts.graying_image,
                             reduceto=opts.reduce_image_to)
     except Exception:
         return None
Example #5
0
 def process_image(self, data):
     if not self.process_images:
         return data
     return (mobify_image(data) if self.opts.mobi_keep_original_images else
             rescale_image(data))