--- title: ASImageNode layout: docs permalink: /docs/image-node.html prevPage: text-node.html nextPage: network-image-node.html --- `ASImageNode` is the Texture equivalent to `UIImageView`. The most basic difference is that images are decoded asynchronously by default. Of course, there are more advanced improvements as well such as GIF support and `imageModificationBlock`s. ### Basic Usage Using an image node works exactly like using an image view.
ASImageNode *imageNode = [[ASImageNode alloc] init];
imageNode.image = [UIImage imageNamed:@"someImage"];
imageNode.contentMode = UIViewContentModeScaleAspectFill;
That's messed up. To fix it, you can set the `cropRect` property to move the image over. By default it is set to `CGRectMake(0.5, 0.5, 0.0, 0.0)`.
The rectangle is specified as a "unit rectangle," using percentages of the source image's width and height. To show the image starting at the left side, you can set the `cropRect`'s `x` value to be `0.0`, meaning the image's origin should start at `{0, 0}` as opposed to the default.
self.animalImageNode.cropRect = CGRectMake(0, 0, 0.0, 0.0);
Alternatively, you can set the `x` value of the origin to `1.0` to right align the image.
### Forced Upscaling
By default, an image won't be upscaled on the CPU when it is too small to fit into the bounds of the `imageNode` it has been set on.
You can set `forceUpscaling` to `YES` if you'd like to change this fact. Doing so means your app will take up more memory any time you use an image that is smaller than its destination.
### Detecting Image Scaling
By using the pixel scaling tool, you can easily check each image in your app to see how much it has been scaled up or down.
If images are too big, you risk rendering excessive amounts of image data, and when they're too small you spend time upscaling a low quality image.
If you control your API, consider returning correctly scaled images so that this work can be avoided.