<h5 dir="auto">System information (version)</h5>

<ul dir="auto">
<li>OpenCV =&gt; ❔</li>
<li>Operating System / Platform =&gt; <g-emoji class="g-emoji" alias="grey_question" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/2754.png">❔</g-emoji></li>
<li>Compiler =&gt; <g-emoji class="g-emoji" alias="grey_question" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/2754.png">❔</g-emoji></li>
</ul>
<h5 dir="auto">Detailed description</h5>

<h5 dir="auto">Steps to reproduce</h5>
<p dir="auto">Passing any of the <code class="notranslate">IMREAD_REDUCED_</code> flags, e.g. <code class="notranslate">IMREAD_REDUCED_GRAYSCALE_2</code>, to the flags parameter of <code class="notranslate">imdecode()</code> has no effect. I notice the <code class="notranslate">imread_()</code> function includes this code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="int scale_denom = 1;
if( flags &gt; IMREAD_LOAD_GDAL )
{
if( flags &amp; IMREAD_REDUCED_GRAYSCALE_2 )
    scale_denom = 2;
else if( flags &amp; IMREAD_REDUCED_GRAYSCALE_4 )
    scale_denom = 4;
else if( flags &amp; IMREAD_REDUCED_GRAYSCALE_8 )
    scale_denom = 8;
}

/// set the scale_denom in the driver
decoder-&gt;setScale( scale_denom );"><pre class="notranslate"><code class="notranslate">int scale_denom = 1;
if( flags &gt; IMREAD_LOAD_GDAL )
{
if( flags &amp; IMREAD_REDUCED_GRAYSCALE_2 )
    scale_denom = 2;
else if( flags &amp; IMREAD_REDUCED_GRAYSCALE_4 )
    scale_denom = 4;
else if( flags &amp; IMREAD_REDUCED_GRAYSCALE_8 )
    scale_denom = 8;
}

/// set the scale_denom in the driver
decoder-&gt;setScale( scale_denom );
</code></pre></div>
<p dir="auto">This code is absent in <code class="notranslate">imdecode()</code> (and <code class="notranslate">imdecode_</code>).</p>
<p dir="auto">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.</p>