UIImage(MBImageScaling) Category Reference

Declared in UIImage+MBImageScaling.h

Overview

A class extension for UIImage that provides methods for resizing images.

Scaling images to a specific size

– imageScaledToSize:quality:

Scales the receiver to the specified size.

- (nonnull UIImage *)imageScaledToSize:(CGSize)newSize quality:(CGInterpolationQuality)quality

Parameters

newSize

The size of the UIImage to be returned. If this is the same size as the receiver, no scaling is performed and self is returned.

quality

The interpolation quality to use for scaling the image.

Return Value

The resulting image.

Declared In

UIImage+MBImageScaling.h

– imageScaledToSize:

Scales the receiver to the specified size.

- (nonnull UIImage *)imageScaledToSize:(CGSize)newSize

Parameters

newSize

The size of the UIImage to be returned. If this is the same size as the receiver, no scaling is performed and self is returned.

Return Value

The resulting image.

Discussion

Scaling will be performed using the kCGInterpolationDefault interpolation quality.

Declared In

UIImage+MBImageScaling.h

Scaling images by a percentage of the original

– imageScaledByFactor:quality:

Scales the receiver to a new size by applying the specified scale factor.

- (nonnull UIImage *)imageScaledByFactor:(CGFloat)scale quality:(CGInterpolationQuality)quality

Parameters

scale

The scale factor that determines the size of the returned image. Numbers less than 1.0 result in a smaller image; numbers greater than 1.0 result in a larger image. If this value is 1.0 exactly, no scaling is performed and self is returned.

quality

The interpolation quality to use for scaling the image.

Return Value

The resulting image.

Discussion

The new size is determined by multiplying the width and height by the scale factor.

Declared In

UIImage+MBImageScaling.h

– imageScaledByFactor:

Scales the receiver to a new size by applying the specified scale factor.

- (nonnull UIImage *)imageScaledByFactor:(CGFloat)scale

Parameters

scale

The scale factor that determines the size of the returned image. Numbers less than 1.0 result in a smaller image; numbers greater than 1.0 result in a larger image. If this value is 1.0 exactly, no scaling is performed and self is returned.

Return Value

The resulting image.

Discussion

The new size is determined by multiplying the width and height by the scale factor.

Scaling will be performed using the kCGInterpolationDefault interpolation quality.

Declared In

UIImage+MBImageScaling.h