diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:24:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:24:48 +0000 |
commit | cca66b9ec4e494c1d919bff0f71a820d8afab1fa (patch) | |
tree | 146f39ded1c938019e1ed42d30923c2ac9e86789 /share/extensions/raster_output_jpg.py | |
parent | Initial commit. (diff) | |
download | inkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.tar.xz inkscape-cca66b9ec4e494c1d919bff0f71a820d8afab1fa.zip |
Adding upstream version 1.2.2.upstream/1.2.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'share/extensions/raster_output_jpg.py')
-rw-r--r-- | share/extensions/raster_output_jpg.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/share/extensions/raster_output_jpg.py b/share/extensions/raster_output_jpg.py new file mode 100644 index 0000000..4235044 --- /dev/null +++ b/share/extensions/raster_output_jpg.py @@ -0,0 +1,28 @@ +#!/usr/bin/env python +""" +Convert PNG to Jpeg using Raster Output extension. +""" + +import inkex + + +class JpegOutput(inkex.RasterOutputExtension): + multi_inx = True # XXX Remove this after refactoring + + def add_arguments(self, pars): + pars.add_argument("--tab") + pars.add_argument("--quality", type=int, default=90) + pars.add_argument("--progressive", type=inkex.Boolean, default=False) + + def save(self, stream): + self.img.convert("RGB").save( + stream, + format="jpeg", + quality=self.options.quality, + dpi=self.img.info["dpi"], + progressive=self.options.progressive, + ) + + +if __name__ == "__main__": + JpegOutput().run() |