图片格式

图片格式是什么?

当您发送图片时,需要指定一个IMG_FORMAT参数,参数为以下宏定义之一。

如有疑惑,请查看本目录下各个协议的详细说明。

IMG_FORMAT图片格式宏定义

enum ImgFormat {
Format_Invalid,
Format_Mono,
Format_MonoLSB,
Format_Indexed8,
Format_RGB32,
Format_ARGB32,
Format_ARGB32_Premultiplied,
Format_RGB16,
Format_ARGB8565_Premultiplied,
Format_RGB666,
Format_ARGB6666_Premultiplied,
Format_RGB555,
Format_ARGB8555_Premultiplied,
Format_RGB888,
Format_RGB444,
Format_ARGB4444_Premultiplied,
Format_RGBX8888,
Format_RGBA8888,
Format_RGBA8888_Premultiplied,
Format_BGR30,
Format_A2BGR30_Premultiplied,
Format_RGB30,
Format_A2RGB30_Premultiplied,
Format_Alpha8,
Format_Grayscale8,
// 以下格式发送时,IMG_WIDTH和IMG_HEIGHT不需要强制指定,设置为-1即可
Format_BMP,
Format_GIF,
Format_JPG,
Format_PNG,
Format_PBM,
Format_PGM,
Format_PPM,
Format_XBM,
Format_XPM,
Format_SVG,
};

如果发送的是BMP、GIF、JPG、PNG、SVG等,已在数据中包含图片长宽的格式,IMG_WIDTH和IMG_HEIGHT不需要指定,设置为-1即可。

图片格式英文释义

ConstantValueDescription
Format_Invalid0The image is invalid.
Format_Mono1The image is stored using 1-bit per pixel. Bytes are packed with the most significant bit (MSB) first.
Format_MonoLSB2The image is stored using 1-bit per pixel. Bytes are packed with the less significant bit (LSB) first.
Format_Indexed83The image is stored using 8-bit indexes into a colormap.
Format_RGB324The image is stored using a 32-bit RGB format (0xffRRGGBB).
Format_ARGB325The image is stored using a 32-bit ARGB format (0xAARRGGBB).
Format_ARGB32_Premultiplied6The image is stored using a premultiplied 32-bit ARGB format (0xAARRGGBB), i.e. the red, green, and blue channels are multiplied by the alpha component divided by 255. (If RR, GG, or BB has a higher value than the alpha channel, the results are undefined.) Certain operations (such as image composition using alpha blending) are faster using premultiplied ARGB32 than with plain ARGB32.
Format_RGB167The image is stored using a 16-bit RGB format (5-6-5).
Format_ARGB8565_Premultiplied8The image is stored using a premultiplied 24-bit ARGB format (8-5-6-5).
Format_RGB6669The image is stored using a 24-bit RGB format (6-6-6). The unused most significant bits is always zero.
Format_ARGB6666_Premultiplied10The image is stored using a premultiplied 24-bit ARGB format (6-6-6-6).
Format_RGB55511The image is stored using a 16-bit RGB format (5-5-5). The unused most significant bit is always zero.
Format_ARGB8555_Premultiplied12The image is stored using a premultiplied 24-bit ARGB format (8-5-5-5).
Format_RGB88813The image is stored using a 24-bit RGB format (8-8-8).
Format_RGB44414The image is stored using a 16-bit RGB format (4-4-4). The unused bits are always zero.
Format_ARGB4444_Premultiplied15The image is stored using a premultiplied 16-bit ARGB format (4-4-4-4).
Format_RGBX888816The image is stored using a 32-bit byte-ordered RGB(x) format (8-8-8-8). This is the same as the Format_RGBA8888 except alpha must always be 255. (added in Qt 5.2)
Format_RGBA888817The image is stored using a 32-bit byte-ordered RGBA format (8-8-8-8). Unlike ARGB32 this is a byte-ordered format, which means the 32bit encoding differs between big endian and little endian architectures, being respectively (0xRRGGBBAA) and (0xAABBGGRR). The order of the colors is the same on any architecture if read as bytes 0xRR,0xGG,0xBB,0xAA. (added in Qt 5.2)
Format_RGBA8888_Premultiplied18The image is stored using a premultiplied 32-bit byte-ordered RGBA format (8-8-8-8). (added in Qt 5.2)
Format_BGR3019The image is stored using a 32-bit BGR format (x-10-10-10). (added in Qt 5.4)
Format_A2BGR30_Premultiplied20The image is stored using a 32-bit premultiplied ABGR format (2-10-10-10). (added in Qt 5.4)
Format_RGB3021The image is stored using a 32-bit RGB format (x-10-10-10). (added in Qt 5.4)
Format_A2RGB30_Premultiplied22The image is stored using a 32-bit premultiplied ARGB format (2-10-10-10). (added in Qt 5.4)
Format_Alpha823The image is stored using an 8-bit alpha only format. (added in Qt 5.5)
Format_Grayscale824The image is stored using an 8-bit grayscale format. (added in Qt 5.5)
Format_BMP,25BMP,
Format_GIF,26GIF,
Format_JPG,27JPG,
Format_PNG,28PNG,
Format_PBM,29PBM,
Format_PGM,30PGM,
Format_PPM,31PPM,
Format_XBM,32XBM,
Format_XPM,33FXPM,
Format_SVG,34SVG,