imagefileresolutionexplorerimage-resolution

Searching for large images made from a low resolution


I have many product images on my local drive that I got from different sources and some of them are messed up a bit. I'm talking about images that are large in resolution but it is apparent that this resolution has been achieved by resizing the image from a very small source.

Is there a software or something that could find these usualy high-res but low quality images? Thanks for any ideas.

Example of enlarged image from a small source


Solution

  • I have a few ideas, and I'll show what I am getting at with ImageMagick which is installed on most Linux distros and is available (for free) for macOS and Windows.

    Just to clarify what I am talking about, it is the lack of high-frequency information (detail) in images when they upsized (up-rezzed) from smaller images. Here is an example:

    enter image description here

    The technique goes like this. Take an image, copy it, scale it down to a percentage of its original size and then scale it back up and measure how much it differs from the original. Here is an example:

    magick start.jpg -set option:geom "%G" \( +clone -resize 50% -resize "%[geom]"\! \) -metric MSE -compare -format "%[distortion]" info:
    0.00220709
    

    If I now do that in a loop, I can get the MSE ("Mean Squared Error") for resizing an image down to 10% and back up, down to 20% and back up, down to 30% and back up like this:

    for ((size=10;size<100;size+=10)); do
       distortion=$(magick start.jpg -set option:geom "%G" \( +clone -resize "${size}%" -resize "%[geom]"\! \) -metric MSE -compare -format "%[distortion]" info: 2>&1)
       echo $size $distortion
    done
    

    Sample Output

    10 0.00641669
    20 0.00461728
    30 0.00351362
    40 0.0027639
    50 0.00220709
    60 0.00173019
    70 0.00130171
    80 0.000935031
    90 0.000637741
    

    If you run that again, but redirect the output to a file called "data", you can plot it with gnuplot:

    gnuplot --persist -e "set yrange [0:0.01];set title '10: MSE vs Resize Percentage';plot 'data'"
    

    Now, we come to the actual point. If I run the plot for a file that was up-rezzed from 75% of its original size, then again for a file that was up-rezzed from 50% of its original size, and again for 25% and 15%, I can put them together in an animation like this:

    enter image description here

    Hopefully, you can see that the purple points depart from the x-axis (where the MSE error is low) immediately at the point corresponding to the percentage of the original size from which the image was up-rezzed.

    So, I am suggesting that you look at your images and find a threshold for the error that would correspond to the degree of up-rezzing likely to be present and then test the error for any individual image against that threshold.

    This would be just the same if you are on Windows, all the code above is only for generating the plots and numbers to make animations. You just need to get the MSE with one line:

    magick YOURIMAGE -set option:geom "%G" \( +clone -resize "${size}%" -resize "%[geom]"\! \) -metric MSE -compare -format "%[distortion]" info: