def generate_jp2(source_file: str, output_file_path: str):
     in_args = [
         "Clevels=5",
         "Clayers=8",
         "Corder=RLCP",
         "Cuse_sop=yes",
         "Cuse_eph=yes",
         "Cmodes=RESET|RESTART|CAUSAL|ERTERM|SEGMARK",
         "-no_weights",
         "-slope",
         "42988",
         "-jp2_space",
         "sRGB",
     ]
     pykdu_compress.kdu_compress_cli2(source_file,
                                      output_file_path,
                                      in_args=in_args)
     set_dpi(output_file_path, x=400, y=400)
 def make_jp2(source: str, destination: str) -> None:
     """Generate a new jp2 file with Hathi-Trust specs."""
     pykdu_compress.kdu_compress_cli2(
         infile=source,
         outfile=destination,
         in_args=[
             "Clevels=5",
             "Clayers=8",
             "Corder=RLCP",
             "Cuse_sop=yes",
             "Cuse_eph=yes",
             "Cmodes=RESET|RESTART|CAUSAL|ERTERM|SEGMARK",
             "-no_weights",
             "-slope",
             "42988",
             "-jp2_space",
             "sRGB",
         ],
     )
    def process(self, source_file, destination_path):
        basename, ext = os.path.splitext(os.path.basename(source_file))

        output_file_path = os.path.join(destination_path, basename + ".jp2")

        rc = pykdu_compress.kdu_compress_cli2(infile=source_file,
                                              outfile=output_file_path)

        if rc != 0:
            raise ProcessingException("kdu_compress_cli returned "
                                      "nonzero value: {}.".format(rc))
        self.output = output_file_path
        self.status = "Generated {}".format(output_file_path)
Beispiel #4
0
    def process(self, source_file: str, destination_path: str) -> None:
        basename, _ = os.path.splitext(os.path.basename(source_file))

        output_file_path = os.path.join(destination_path, basename + ".jp2")

        return_core = pykdu_compress.kdu_compress_cli2(
            infile=source_file, outfile=output_file_path)

        if return_core != 0:
            raise ProcessingException(
                "kdu_compress_cli returned nonzero value: {return_core}.")

        self.output = output_file_path
        self.status = f"Generated {output_file_path}"
    def process(self, source_file, destination_path):
        basename, ext = os.path.splitext(os.path.basename(source_file))

        output_file_path = os.path.join(destination_path, basename + ".jp2")

        in_args = [
            "Clevels=5",
            "Clayers=8",
            "Corder=RLCP",
            "Cuse_sop=yes",
            "Cuse_eph=yes",
            "Cmodes=RESET|RESTART|CAUSAL|ERTERM|SEGMARK",
            "-no_weights",
            "-slope",
            "42988",
            "-jp2_space",
            "sRGB",
        ]
        pykdu_compress.kdu_compress_cli2(source_file,
                                         output_file_path,
                                         in_args=in_args)
        set_dpi(output_file_path, x=400, y=400)

        self.status = "Generated {}".format(output_file_path)
 def make_jp2(source: str, destination: str) -> None:
     """Generate a new jp2 file with Kakadu jp2 encoder."""
     pykdu_compress.kdu_compress_cli2(infile=source, outfile=destination)