# mxnet.recordio.pack_img¶

mxnet.recordio.pack_img(header, img, quality=95, img_fmt='.jpg')[source]

Pack an image into MXImageRecord.

Parameters
• header (IRHeader) – Header of the image record. header.label can be a number or an array. See more detail in IRHeader.

• img (numpy.ndarray) – Image to be packed.

• quality (int) – Quality for JPEG encoding in range 1-100, or compression for PNG encoding in range 1-9.

• img_fmt (str) – Encoding of the image (.jpg for JPEG, .png for PNG).

Returns

s – The packed string.

Return type

str

Examples

>>> label = 4 # label can also be a 1-D array, for example: label = [1,2,3]
>>> id = 2574