Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>Note:</h2> <p>The answer is in C# not Javascript, there is no way to do this in JS and that was not a requirement in the original question.</p> <h2>About your original question</h2> <p>This is a big dependency of what you consider a "high quality" Image (nice reading BTW). But anyway the quality factor is not stored directly in the JPEG file, so you cannot read directly from the file.</p> <p>Most of these factors involve complex imaging algorithms. But do not be disappointed, you can read some properties using the <code>PropertyItems</code> property on the Image class and make some calculations to get an idea of the quality of the image based on size and dpi or ppi. This is a simple example:</p> <pre><code>Bitmap bmp = new Bitmap("winter.jpg"); Console.WriteLine("Image resolution: " + bmp.HorizontalResolution + " DPI"); Console.WriteLine("Image resolution: " + bmp.VerticalResolution + " DPI"); Console.WriteLine("Image Width: " + bmp.Width); Console.WriteLine("Image Height: " + bmp.Height); </code></pre> <p>This will help too: <a href="https://stackoverflow.com/questions/2207187/how-can-i-get-the-resolution-of-an-image-jpeg-gif-png-jpg">How can I get the resolution of an image? (JPEG, GIF, PNG, JPG)</a></p> <blockquote> <p>"But I want to check selected files image quality before uploading"</p> </blockquote> <p>If you want to check the image quality before upload (as you said in comments), that's a big plus to the question. The only built-in method to get the numbers you're after is by creating a new instance (and decoding the entire image) - which is going to be highly inefficient. But... hey! here is a start point: <a href="https://stackoverflow.com/questions/552467/how-do-i-reliably-get-an-image-dimensions-in-net-without-loading-the-image">How do I reliably get an image dimensions in .NET without loading the image?</a></p> <h2>Further reading:</h2> <ul> <li><a href="http://www.codeproject.com/Articles/35978/Reading-Image-Headers-to-Get-Width-and-Height" rel="nofollow noreferrer">Reading Image Headers to Get Width and Height</a></li> <li><a href="http://en.wikipedia.org/wiki/Image_quality" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Image_quality</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload