コード例 #1
0
ファイル: main.py プロジェクト: Deevad/kraconvert
    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()
コード例 #2
0
ファイル: main.py プロジェクト: bloodywing/kraconvert
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)
コード例 #3
0
ファイル: main.py プロジェクト: LucasBob/kraconvert
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)