Access width of Rect Transform with Unity UI

Hey guys.

I am trying to get the width of an image in Unity 4.6.
The component it’s under is Rect Transform, but I can’t find anything in the documentation, giving me the script to access or modify it.

If you are not sure what I mean, here is a picture:
http://screencast.com/t/kySPs5bV0s

Thanks a lot in advance guys.

“You can get
the width/height using
RectTransform.rect.”

set width/height using
“rectTransform.sizeDelta = new Vector2( yourWidth, yourHeight);”

I was wondering how to do the same thing when I found these answers from troien and Omberone. The questions can be found here and here.

Above answers are correct but there’s special cases where if you use stretching. The width and/or height of the RectTransform.rect and RectTransform.sizeDelta may be <= 0.

this.gameObject.GetComponent().sizeDelta=new Vector2(width(any Value),height(any Value));

Thanks for the answer but I am not sure of the syntax.

Should it be:
objectWidth = gameobject.transform.rect.width? or??