In this 3 minute tutorial we’ll write a tiny JavaScript function that helps us crop images to various aspect ratios. Super useful for cropping photos before posting to social media timelines or uploading profile pictures as these are often required to be of a certain aspect ratio. In this tutorial we’ll by modifying image data. For example, when a user is about to upload a an image we crop it to a
![Cropping Images To A Specific Aspect Ratio With JavaScript](https://cdn-ak-scissors.b.st-hatena.com/image/square/e13d97e000a2fd61b16c7b2abb80bab4a36aa75a/height=288;version=1;width=512/https%3A%2F%2Fpqina.nl%2Fcover%2Fcropping-images-to-an-aspect-ratio-with-javascript.jpeg)