def extract_png(self): for kra in self.kras: png = kra.get_merged_image() png_name = kra.get_basename() + '.png' png_dir = os.path.join(self.outdir, kra.get_basename(), 'png') os.makedirs(png_dir, exist_ok=True) with open(os.path.join(png_dir, png_name), 'w+b') as f: f.write(png) f.close()
def extract_png(kras, outdir): for kra in kras: png = kra.get_merged_image() png_name = kra.get_basename() + '.png' png_name_web = kra.get_basename() + '_srgb.png' png_dir = os.path.join(outdir, kra.get_basename(), 'png') os.makedirs(png_dir, exist_ok=True) kra.merged_image_path = os.path.join(png_dir, png_name) with open(kra.merged_image_path, 'w+b') as f: f.write(png) f.close() if args.webready: im = Image.open(kra.merged_image_path) # BUG: I don't know why but I need to use inPlace here or else # my test png was just transparent ImageCms.profileToProfile(im, kra.icc_path, srgb, inPlace=True) im.save(os.path.join(png_dir, png_name_web), optimize=True)
def extract_png(kras, outdir): for kra in kras: png = kra.get_merged_image() png_name = kra.get_basename() + '.png' png_name_web = kra.get_basename() + '-srgb.png' png_dir = os.path.join(outdir, kra.get_basename(), 'png') os.makedirs(png_dir, exist_ok=True) kra.merged_image_path = os.path.join(png_dir, png_name) with open(kra.merged_image_path, 'wb') as f: f.write(png) f.close() if args.webready: im = Image.open(kra.merged_image_path) # BUG: I don't know why but I need to use inPlace here or else # my test png was just transparent ImageCms.profileToProfile(im, kra.icc_path, srgb, inPlace=True) im.save(os.path.join(png_dir, png_name_web), optimize=True)