We all sometimes find images on the web that are carelessly stretched to larger dimensions than original, which results in nothing but a reduction of the detail / dimensions ratio.

See Original vs Stretched below:

Source: Kaley Cuoco (Model), Esquire (Latin America)






  1. Given only Stretched, is there a way to automatically find the best dimensions to shrink Stretched down to which maximizes the detail / dimensions ratio?
  2. Is there a generic way to define detail for all images (photos, line-art, text, etc.)?
  3. Is 'stretched' the correct term or is there a more technically correct applicable?
  • 2
    $\begingroup$ Is this question about Mathematica or image processing in general? $\endgroup$ – Yves Klett Mar 26 '13 at 10:43
  • $\begingroup$ @YvesKlett it is about a working examplery implementation in Mathematica but general answers with hints might also be useful. $\endgroup$ – Cetin Sert Mar 26 '13 at 11:08
  • 1
    $\begingroup$ There's a lot to read here, particularly about Error level Analysis, but I'm not convinced that simple resizing operations are going to show up, although I know little about it... $\endgroup$ – cormullion Mar 26 '13 at 16:51

I think the answer to your general questions is "no" there is no way that is going to allow you to figure out the original size of an image given only the upsampled (or resized) image in all cases. If you know the correct size to aim for, the mechanics in Mathematica would be simple:

 ImageResize[image , desiredSize]

So, how might you go about this? One thing is to note that if the image has been upsampled, then it has no more information in it than a smaller version. So you might try something like this:

(1) resize to a smaller version (2) resize back from the smaller version to the larger size (3) compare your new (doubly resized image) to the original (4) if there is not much difference, then you might as well keep the smaller one

Then do this for several candidate sizes until you find the best one. Of course, step (3) requires a measure of closeness of images. For this you might try ImageDistance.

  • $\begingroup$ +1 Good advice. However, I fear the result of your workflow might depend more on your choice of resampling method than on internal characteristics of the image. $\endgroup$ – whuber Mar 26 '13 at 15:01
  • $\begingroup$ True... but there are only about 23 methods under the Resampling help. So at least it's not infinite! $\endgroup$ – bill s Mar 26 '13 at 15:13
  • $\begingroup$ Unfortunately, it doesn't matter how many methods are available: since they all lead to arbitrary results, it won't do any good to try them all. The problem stems from the inherent (potential) change of information content in the originally resized image compared to the (unknown) original image. All your procedure does is evaluate some of the statistical properties of these resampling procedures as applied to one particular input image. $\endgroup$ – whuber Mar 26 '13 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.