Error When Choosing Tiff ImagePixelFormat

The following example code (from here) returns an error

options.pixel_format = slides.export.ImagePixelFormat.FORMAT_8BPP_INDEXED
** File “C:\Program Files\Python39\lib\enum.py”, line 429, in getattr**
** raise AttributeError(name) from None**
AttributeError: FORMAT_8BPP_INDEXED

Any idea what is wrong please?

import aspose.slides as slides

# Instantiate a Presentation object that represents a presentation file
pres = slides.Presentation("pres.pptx")

# Instantiate the TiffOptions class
options = slides.export.TiffOptions()

options.pixel_format = slides.export.ImagePixelFormat.FORMAT_8BPP_INDEXED

# Save the presentation to TIFF with specified image size
pres.save("Tiff_With_Custom_Image_Pixel_Format_out.tiff", slides.export.SaveFormat.TIFF, options)

@bowespublishing,
Thank you for contacting support. Unfortunately, I have not managed to reproduce the error you have encountered. Please try reinstalling Python. If the issue persists, please share more information on how to reproduce the error on our end.

Fixed it. It’s because

options.pixel_format = slides.export.ImagePixelFormat.FORMAT_8BPP_INDEXED

should be

options.pixel_format = slides.export.ImagePixelFormat.FORMAT8BPP_INDEXED

@bowespublishing,
No, it’s not. The original example is correct. I don’t see how it works for you.

Well it doesn’t work for me and the alternative version does!

@bowespublishing,
I don’t understand how this is possible, but we are glad the issue has been resolved.