예제 #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
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)