import os
import sys

output_path = '@BUILDDIR@/New_GIMP_Project.xcf'
default_width  = 1920
default_height = 1080
image = Gimp.Image.new(default_width, default_height, Gimp.ImageBaseType.RGB)
layer = Gimp.Layer.new(image, None, default_width, default_height,
                       Gimp.ImageType.RGB_IMAGE, 100.0, Gimp.LayerMode.NORMAL)
layer.fill(Gimp.FillType.WHITE)
image.insert_layer(layer, None, 0)

procedure = Gimp.get_pdb().lookup_procedure("gimp-xcf-save")
config    = procedure.create_config()
drawables = image.list_selected_drawables()
config.set_property("image", image)
config.set_property("num-drawables", len(drawables))
config.set_property("drawables", Gimp.ObjectArray.new(Gimp.Drawable, drawables, False))
config.set_property("file", Gio.file_new_for_path(output_path))
Gimp.Procedure.run(procedure, config)

v = Gimp.Procedure.run(procedure, config)

if v.index(0) != Gimp.PDBStatusType.SUCCESS:
  sys.exit(os.EX_SOFTWARE)
