| Classes - Annotated - Tree - Functions - Home - Structure

# QEmbed - File and Image Embedder

The QEmbed tool, found in `qt/tools/qembed` converts arbitrary files into C++ code. This is useful for including image files and other resources directly into your application rather than loading the data from external files.

QEmbed can also generate uncompressed versions of images that can be included directly into your application, thus avoiding both the external file and the need to parse the image file format. This is useful for small images such as icons for which compression is not a great gain.

## Usage

        qembed [ general-files ] [ --images image-files ]

`general-files`
  These files can be any type of file.
`--images image-files`
  These files must be in image formats supported by Qt.

## Output

The output from QEmbed is a C++ header file which you should include in a C++ source file. In that file, you should make a wrapper function that suites your application. Two inline functions are provided, and your wrapper function could just call one of these, or you can implement your own. To use the inline functions in the simplest way:

        #include "generated_qembed_file.h"

        // Just call the generated function
        // "name" is the original image filename WITHOUT the extension
        QImage myFindImage(const char* name)
        {
            return qembed_findImage(name);
        }

        // Just call the generated function
        // "name" is the original filename WITH the extension
        QByteArray myFindData(const char* name)
        {
            return qembed_findData(name);
        }

Alternatively, look at the output from QEmbed and write a function more tailored to the needs of your application.