CopperSpice API  1.7.2
Icons, Images, and Pictures

A CopperSpice application can load and save images using the QImage and QPixmap classes. The most common image formats are built into CopperSpice.

  • png
  • jpeg
  • tiff
  • ico

If you want to use one of the following formats you will need to provide one of the following plugins.

  • gif
  • mng
  • svg
  • tga

Users can add support for additional formats via the QImageIOPlugin class. This is done by deriving from the QImageIOHandler class and creating a QImageIOPlugin object which is a factory for creating QImageIOHandler objects. When the plugin is installed QImageReader and QImageWriter will automatically load the plugin and start using it.

Reading and Writing Image Files

There are three different ways to load an image and they are each optimized for different use cases.

Optimized for manipulating the image data before display.
Optimized for displaying an image on the screen.
Provides more control over the loading process, requires more setup and returns a QImage.

The QImageWriter class supports setting format specific options, such as the gamma level, compression level and quality, prior to storing the image. If you do not need such options, you can use QImage::save() or QPixmap::save() instead.

The QImageReader and QImageWriter classes rely on the QImageIOHandler class which is the common image I/O interface for all image formats. QImageIOHandler objects are used internally by QImageReader and QImageWriter to add support for different image formats.