mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 09:53:25 +00:00
python: Fix crash when exporting indexed ORA images
Exporting ORA images involves first creating PNGs of the layers. To do this, we create separate images for each layer with Gimp.Image.new (). However, if the original image was indexed, we lose the palette when passing the temporary image to the PDB call. This caused us to try saving a NULL palette, which resulted in the crash. This patch adds a check if the image is indexed, and copies over the palette to the temporary image.
This commit is contained in:
parent
a091b6b2d8
commit
4cd3360d53
1 changed files with 3 additions and 0 deletions
|
@ -218,6 +218,9 @@ def export_ora(procedure, run_mode, image, file, options, metadata, config, data
|
|||
|
||||
width, height = drawable.get_width(), drawable.get_height()
|
||||
tmp_img = Gimp.Image.new(width, height, image.get_base_type())
|
||||
if (image.get_base_type() == Gimp.ImageBaseType.INDEXED):
|
||||
tmp_img.set_palette(image.get_palette())
|
||||
|
||||
tmp_layer = Gimp.Layer.new_from_drawable (drawable, tmp_img)
|
||||
tmp_img.insert_layer (tmp_layer, None, 0)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue