Check-in [c3d85c855b]
Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | hex_color int(alpha), -background None fallback (semi-transparency likely requires a `-channel A -ordered-dither checker` pattern) |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c3d85c855b6f50ffc210b7c31d9975e6 |
User & Date: | mario 2022-10-08 17:41:40 |
Context
2022-10-09
| ||
16:36 | prepare magick v7 support, minor parameter rework, dissolve duration_arg(), experiment with more convert options check-in: af566d903e user: mario tags: trunk | |
2022-10-08
| ||
17:41 | hex_color int(alpha), -background None fallback (semi-transparency likely requires a `-channel A -ordered-dither checker` pattern) check-in: c3d85c855b user: mario tags: trunk | |
2022-10-07
| ||
10:44 | individual imports, pre-extract layer.animate, rejoin hex_color and convert_png, add forced export-background (opacity non-func) check-in: e72aece332 user: mario tags: trunk | |
Changes
Changes to inkscape/Makefile.
1 2 3 4 5 6 7 8 9 10 | SHELL := /bin/bash .PHONY: zip wiki zip: zip export_gif.zip export_gif.py export_gif.inx export_gif.svg saveas_gif.inx pmd2inks LICENSE svgelements.py gpg --yes --default-key 15EA8459B4448BEF4EA9C45E6A12374187A40D51 -b -a -o export_gif.zip.sig -s export_gif.zip zip animate_yo.zip animate_yo.py animate_yo.inx animate_yo.svg | < < | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | SHELL := /bin/bash .PHONY: zip wiki zip: zip export_gif.zip export_gif.py export_gif.inx export_gif.svg saveas_gif.inx pmd2inks LICENSE svgelements.py gpg --yes --default-key 15EA8459B4448BEF4EA9C45E6A12374187A40D51 -b -a -o export_gif.zip.sig -s export_gif.zip zip animate_yo.zip animate_yo.py animate_yo.inx animate_yo.svg sha384sum animate_yo.zip > animate_yo.zip.sha384 inx: ./pmd2inks export_gif.py | xmllint -format - > export_gif.inx ./pmd2inks animate_yo.py | xmllint -format - > animate_yo.inx deb: xpm -s src -t deb --deb-sign incl -n inkscape-export-gif --prefix /usr/share/inkscape/extensions -f export_gif.py pylint: PYTHONPATH=/usr/share/inkscape/extensions/ pylint export_gif.py animate_yo.py wiki: fw inkscape |
Added inkscape/NEWS.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 1.1 (unreleased) * individual imports, pre-extract layer.animate * rejoin hex_color and convert_png * add forced export-background (convert recognition still non-functional) 1.0 (2022-10-06) * more animation support * including some pacing/keytimes understanding * redesigned dialog * Animate-Yo (0.5) includes new notebook for timing options 0.9 (2022-09-30) * add [merge] grouping * preliminary animation support * new Animate-Yo companion tool 0.8 (2022-09-30) * support per frame [--options=xyz] options * and [exclude] 0.7 (2022-09-26) * introduce combined modes * JavaScript embed option * moved repositories (from H.I.) 0.6 (2022-09-22) * support file→save-as invocation 0.5 (2022-09-21) * revamped layer combination handling * merge modes into dropdown * simplified clean_up, pylint checking 0.4 (2022-09-21) * support SVG export by removing nodes * use newer inkex.* interfaces 0.3 (2022-09-20) * introduced more imagemagick options * attributes for pmd2inx 0.2 (2022-09-19) * migrated to plugin meta data * more robust file handling 0.1 (unreleased) * prototype |
Changes to inkscape/export_gif.py.
︙ | ︙ | |||
96 97 98 99 100 101 102 | # option. Potential error popups become informative at the very end. # # Code is derived from Xavi's "Export Layers Redux For Inkscape 1.1+". # <https://inkscape.org/~VagabondArcade/%E2%98%85export-layers-redux-for-inkscape-11> # # ZIP contains the `pmd2inks` command-line tool to ease extending the # options dialog (using the <https://pypi.org/project/pluginconf/> format). | < < < < < < < < < < < | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | # option. Potential error popups become informative at the very end. # # Code is derived from Xavi's "Export Layers Redux For Inkscape 1.1+". # <https://inkscape.org/~VagabondArcade/%E2%98%85export-layers-redux-for-inkscape-11> # # ZIP contains the `pmd2inks` command-line tool to ease extending the # options dialog (using the <https://pypi.org/project/pluginconf/> format). import sys import copy import os import tempfile from argparse import Namespace |
︙ | ︙ | |||
242 243 244 245 246 247 248 | def convert_png(self, svg_path, png_path): """ Use the convenience wrapper (more likely referencing the current inkscape binary) """ extra = {} if self.options.background and self.options.export_background: color = inkex.Color(self.options.background) extra.update({ "export_background": self.hex_color(color, with_alpha=False), | | | | | | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | def convert_png(self, svg_path, png_path): """ Use the convenience wrapper (more likely referencing the current inkscape binary) """ extra = {} if self.options.background and self.options.export_background: color = inkex.Color(self.options.background) extra.update({ "export_background": self.hex_color(color, with_alpha=False), "export_background_opacity": "{:.2f}".format(color.alpha), }) inkex.command.inkscape( svg_path, export_area_page=True, export_type="png", export_filename=png_path, export_text_to_path=True, **extra, #export_dpi=96, --export-width --export-height ) def imagick_gif(self, temp_files_args): """ Run `convert` using list of exported slides """ inkex.command.call(*[ "convert", "-delay", float(self.options.delay) * 100, "-loop", self.options.loop, "-layers", self.options.layers, "-fuzz", self.options.fuzz, # ToDo: distribute some flags into temp_files_args? "-background", self.hex_color(self.options.background) if self.options.background else "None", *shlex.split(self.options.extra), *shlex.split(self.options.extra2), *self.zip_args(temp_files_args), *[os.path.expanduser(self.options.file)] ]) @staticmethod def hex_color(color, with_alpha=True): """ convert ints or inkex.Color tuple to #RRGGBBAA string """ color = inkex.Color(color) formatted = "#{:02X}{:02X}{:02X}".format(*color.to_rgb()) if with_alpha: formatted += "{:02X}".format(int(255 * min(1.0, color.alpha))) return formatted @staticmethod def zip_args(temp_files_args): """ unzip files and possible -args (fitted list of dicts) """ for filename, arg_list in temp_files_args: for key, val in arg_list.items(): |
︙ | ︙ |