1
$\begingroup$

enter image description here

Want to rotate this image and then trim it. consider

image=R6UgC.jpg;
Imrot=Rotate[image, 2 Degree];
ImageTrim[Imrot, {{560, 400}, {900, 900}}]

getting error ImageTrim::imginv: Expecting an image or graphics instead...

$\endgroup$
  • 1
    $\begingroup$ Use ImageRotate instead of Rotate. Rotate works on Graphics primitives and objects and returns a Graphics primitive or objects with head Rotate. $\endgroup$ – Sjoerd C. de Vries Apr 22 '15 at 16:19
  • $\begingroup$ @Sjoerd Post that as an answer or I shall close as "simple mistake." $\endgroup$ – Mr.Wizard Apr 22 '15 at 16:25
  • $\begingroup$ @Mr.Wizard Should the mere existence of an answer invalidate the "simple mistake" closing reason? (seriously) $\endgroup$ – Dr. belisarius Apr 22 '15 at 16:34
  • $\begingroup$ Thanks for the answer. I have one more question...How to enhanced the image quality or intensity. $\endgroup$ – santosh Apr 22 '15 at 16:36
  • $\begingroup$ @belisarius No... I expect this would likely be closed either way; I was giving Sjoerd a change to answer if he wanted to. I suppose in hindsight that could seem like favoritism but rather I thought that possibly the answer would be slightly less trivial than the comment and that maybe it could stay open for that reason. $\endgroup$ – Mr.Wizard Apr 22 '15 at 16:37
4
$\begingroup$

Use ImageRotate instead of Rotate. Rotate works on Graphics primitives and objects and returns a Graphics primitive or objects with head Rotate.

(* with ImageRotate increased angle for illustrative purposes *)
image = Import["http://i.stack.imgur.com/R6UgC.jpg"];
Imrot = ImageRotate[image, 20 Degree];
ImageTrim[Imrot, {{560, 400}, {900, 900}}]

Mathematica graphics

See the difference:

Rotate[image, 20 Degree]

Mathematica graphics

Head@Rotate[image, 20 Degree]

Rotate

Head@Imrot

Image

$\endgroup$

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.