Fix gimp palette files being exported with a bogus Name field (81912dec) · Commits · Inkscape / extensions · GitLab
Martin Owens
·
2026-06-25
·
via Martin Owens activity
Fix gimp palette files being exported with a bogus Name field
Previously, most gpl files would write an empty string Name field,
like "Name: \n" and that would cause an error on import because of the
empty name.
So the fix is in two parts. One of which is in this extension code:
- If the name is an empty string, don't write it out. This matches
behavior elsewhere in Inkscape for writing out gpl files.
And the other is in the main Inkscape code:
- Be more permissive when reading gpl files, and don't error out when
the name is empty.
Related to inkscape/inkscape#6234
| Original line number |
Diff line number |
Diff line |
|
@@ -33,7 +33,8 @@ class ExportGimpPalette(inkex.OutputExtension): |
|
|
|
|
|
def save(self, stream):
|
|
|
name = self.svg.name.replace(".svg", "")
|
|
|
stream.write("GIMP Palette\nName: {}\n#\n".format(name).encode("utf-8"))
|
|
|
name = f"Name: {name}\n" if name else ""
|
|
|
stream.write("GIMP Palette\n{}#\n".format(name).encode("utf-8"))
|
|
|
|
|
|
for key, value in sorted(list(set(self.get_colors()))):
|
|
|
stream.write("{} {}\n".format(key, value).encode("utf-8"))
|
|
|
| Original line number |
Diff line number |
Diff line |
|
|
GIMP Palette
|
|
|
Name:
|
|
|
#
|
|
|
0 0 0 #000000
|
|
|
0 0 0 BLACK
|
|
|
| Original line number |
Diff line number |
Diff line |
|
|
GIMP Palette
|
|
|
Name:
|
|
|
#
|
|
|
0 0 0 BLACK
|
|
|
46 52 54 #2E3436
|
|
|
| Original line number |
Diff line number |
Diff line |
|
|
GIMP Palette
|
|
|
Name:
|
|
|
#
|
|
|
0 0 0 BLACK
|
|
|
255 0 0 RED |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。