nn::jpeg::CTR::JpegMpEncoder::SetThumbnailSize Member Function#include <nn/jpeg.h>
void SetThumbnailSize(
u32 width,
u32 height,
PixelSampling dstPixelSampling = DEFAULT_THUMBNAIL_PIXEL_SAMPLING
);
| Name | Description | |
|---|---|---|
| in | width | Specifies the thumbnail width in pixels. (Up to 65535.) |
| in | height | Specifies the thumbnail height in pixels. (Up to 65535.) |
| in | dstPixelSampling | Specifies the image's output format (its pixel sampling). The default is DEFAULT_THUMBNAIL_PIXEL_SAMPLING (PIXEL_SAMPLING_YUV422). |
Specifies the thumbnail image size and output format.
If the encoding function appends a thumbnail, the thumbnail image size in pixels is by default DEFAULT_THUMBNAIL_WIDTH (160) wide and DEFAULT_THUMBNAIL_HEIGHT (120) high, with an aspect ratio of 4:3.
The thumbnail is generated to have the specified image size, so when the original image has an aspect ratio that is not 4:3, the thumbnail image is shrunk more on one axis than the other, leading to image distortion.
By specifying the thumbnail image size with this function, you can ensure that the original image and thumbnail image aspect ratios match or are at least close. If the thumbnail image size is increased too much, the image will not fit in the APP1 segment (up to byte 0xFFFF) and encoding will fail.
The specifiable image sizes change depending on the output format (the dstPixelSampling argument).
PIXEL_SAMPLING_YUV444 is specified, the width and height of the image must both be multiples of 8.PIXEL_SAMPLING_YUV420 is specified, the width and height of the image must both be multiples of 16.PIXEL_SAMPLING_YUV422 is specified, the height must be a multiple of 8 and the width a multiple of 16.The default image output format is DEFAULT_THUMBNAIL_PIXEL_SAMPLING (PIXEL_SAMPLING_YUV422).
Call this function before calling the encoding function. The values specified by this function are cleared after the encoding function completes, regardless of whether the encoding function succeeded or failed. When encoding multiple times, you must call this function before each encoding function call. The values specified by this function are cleared if you reinitialize the encoder object using the Initialize function.
If the combination of the width, height, and dstPixelSampling arguments is invalid, all these values are replaced with the defaults.
CONFIDENTIAL