-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
imdecode ignores IMREAD_REDUCED_* flags #16203
Copy link
Copy link
Closed
Labels
Milestone
Description
Passing any of the IMREAD_REDUCED_ flags, e.g. IMREAD_REDUCED_GRAYSCALE_2, to the flags parameter of imdecode() has no effect. I notice the imread_() function includes this code:
int scale_denom = 1;
if( flags > IMREAD_LOAD_GDAL )
{
if( flags & IMREAD_REDUCED_GRAYSCALE_2 )
scale_denom = 2;
else if( flags & IMREAD_REDUCED_GRAYSCALE_4 )
scale_denom = 4;
else if( flags & IMREAD_REDUCED_GRAYSCALE_8 )
scale_denom = 8;
}
/// set the scale_denom in the driver
decoder->setScale( scale_denom );
This code is absent in imdecode() (and imdecode_).
For those that aren't familiar with that flag: The expected effect is that the image is resized by the stated factor if it is a JPEG. This happens for "free" due to the way the JPEG encoding works, so it is much faster than opening the image at full resolution and then doing a separate resize.
Reactions are currently unavailable