If the image has an indexed pixel format, this method throws an exception with the message, "A xtd::drawing::graphics object cannot be created from an image that has an indexed pixel format." The indexed pixel formats are shown in the following list.
You can save the indexed image as another format by using the xtd::drawing:image::save(xtd::string, xtd::drawing::imaging::image_format) method and then retrieve a xtd::drawing::graphics object for the new image.
This method also throws an exception if the image has any of the following pixel formats.