Skip to content

Instantly share code, notes, and snippets.

@Avantol13
Created August 30, 2020 16:54
Show Gist options
  • Save Avantol13/613c4712a7b7450d13dbf377fee68cb6 to your computer and use it in GitHub Desktop.
Save Avantol13/613c4712a7b7450d13dbf377fee68cb6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from gimpfu import *
# can run in python console with default values with:
# pdb.python_fu_export_eps("", "test23.eps", 0, 0)
def export_eps(folder, filename, width, height):
folder = folder or "F:\\_GoogleDrive\\Other Projects\\Board Games\\Food Game\\_cards"
width = width or 699.1
height = height or 953.1
image = gimp.image_list()[0]
filepath = folder + "\\" + filename
x_offset = 5.0
y_offset = 5.0
unit = 1
keep_ratio = 1
rotation = 0
eps_flag = 1
preview = 0
level = 2
new_image = pdb.gimp_image_duplicate(image)
new_image.flatten()
layer = pdb.gimp_image_merge_visible_layers(new_image, CLIP_TO_IMAGE)
pdb.gimp_layer_flatten(layer)
pdb.file_eps_save(
new_image, layer, filepath, filepath, width, height, x_offset,
y_offset, unit, keep_ratio, rotation, eps_flag, preview, level
)
register(
"export_eps",
'A simple Python-Fu "Export EPS File" plug-in',
'A simple Python-Fu "Export EPS File" plug-in. Has a default folder location',
"Alex VanTol",
"Alex VanTol 2020. MIT License",
"2020",
"Export EPS",
"",
[
(PF_STRING, "folder", "folder", "F:\\_GoogleDrive\\Other Projects\\Board Games\\Food Game\\_cards"),
(PF_STRING, "filename", "filename", "test.eps"),
(PF_FLOAT, "width", "width", 699.1),
(PF_FLOAT, "height", "height", 953.1)
],
[],
export_eps,
menu="<Image>/Filters/Export_EPS",
)
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment