2
$\begingroup$

I have an image assigned to myPicture

myPicture =

enter image description here

 Image[myPicture, ImageSize -> {500, 300}]

I get result like this, after evaluation:

enter image description here

My problem is that the image is not fitted to the rectangle. How can I solve that one?

$\endgroup$
1
  • 1
    $\begingroup$ I think you are over constraining your requirements since the aspect ratio of images is different than the aspect ratio of the space you to put it into. $\endgroup$
    – m_goldberg
    Nov 8, 2012 at 8:33

1 Answer 1

2
$\begingroup$
ImageResize[myPicture, {500, 300}]

or

Show[myPicture, ImageSize -> {500, 300}, AspectRatio -> 3/5]

or, more generally,

Show[myPicture, ImageSize -> {500, 300}, AspectRatio -> Full]

butterfly

$\endgroup$
3
  • $\begingroup$ I hope you don't mind. I just did not want to waste a new answer to such a one-liner. $\endgroup$ Nov 8, 2012 at 9:44
  • $\begingroup$ @IstvánZachar No problem - I prefer answers to comments anyway :) $\endgroup$
    – cormullion
    Nov 8, 2012 at 9:45
  • $\begingroup$ A good preference, indeed :) $\endgroup$ Nov 8, 2012 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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