私はそのような通常のコードを持っています:
struct jpeg_decompress_struct cinfo;
jpeg_create_decompress(&cinfo);
jpeg_stdio_src(&cinfo, infile);
jpeg_read_header(&cinfo, TRUE);
cinfo.scale_num = ?;
cinfo.scale_denom = ?;
needed_width = cinfo.output_width;
needed_height = cinfo.output_height;
scale_numおよびscale_denumパラメータを取得して、イメージを必要なサイズにスケーリングする方法。たとえば、2倍小さくスケーリングしたい。
私が設定した場合scale_num = 1
、scale_denom = 2
。結果: (1802 x 1237) から (258 x 194)
ドキュメントには次のように記載されています。
Scale the image by the fraction scale_num/scale_denom. Default is
1/1, or no scaling. Currently, the only supported scaling ratios
are 1/1, 1/2, 1/4, and 1/8.
しかし、そのような比率を設定すると、必要な結果が得られません。
問題は次 のとおりです。必要な最大サイズの画像を設定して取得する方法。scale_num
scale_denom