Image_Transform brings you a lot of methods to scale images. Most of them call the basic resizing method with different parameters, but still have their right to exist because they make your life convenient. Here is a short list:
resize
- generic resizing method. Pass any size, percentage string
(with %
) or a scaling factor for both
x and y values. Keep it 0 to keep that size. Does not necessarily
keep the aspect ratio.
scaleByX - scale the image by resizing the width of the image to the given pixel size. Preserves aspect ratio.
scaleByY - scale the image by resizing the height of the image to the given pixel size. Preserves aspect ratio.
scale
- generig scaling function. Pass a pixel value, percentage (with
%
) or scaling factor (<1). Keeps aspect ratio.
scaleByPercentage - scales by the given percentage.
scaleByFactor - same as scaleByPercentage(), just that the numbers are factor 100 smaller.
scaleByLength - scale so that the longest size has the desired size.
fit - scale the image so that it fits into the given box (width and height). Nothing is done if the image is already smaller or equal than the box size.
fitX - scale the image so that the width is the given size. If the width is already smaller, nothing is done.
fitY - scale the image so that the height is the given size. If the height is already smaller, nothing is done.