# Resize to Fit

## What does it do?

The resize to Fit operation will rescale the image so that it fit into the defined pixel rectangle as closely as possible. Aspect ratio is preserved so the image is not stretched and will end up being either the width or height specified but not both unless the apsect ratio of the image is the same as the specified new size.

## Example in Java to resize an image

File input = new File("path\to\file");
File output = new File("path\to\output rotated file");

ImageProcessingOperations operations = new ImageProcessingOperations();
operations.resizeToFit(100, 100); // make image fit into a box 100x100 pixels preserving aspect ratio
//you can chain other operations here like scale, blur, etc

JDeli.convert(input,output,operations);


Click here for a full list of Image Processing Operations and more general information on Image processing with JDeli.

Still need help? Send us your questions.