How to stop WordPress from generating multiple image sizes

When you upload an image using the media uploader of your WordPress site, it creates multiple sizes of that image. By default, WordPress creates 4 additional sizes, but your theme and/or plugin(s) may create more sizes of that image. And it's really a headache when you are considering your storage.

So, how to stop it?

There are 2 ways to stop WordPress from generating multiple image sizes-

1. With Coding: Set a filter to intermediate_image_sizes_advanced. It returns an array that contains the sizes. Make it return an empty array, and phew! You're done.
Paste this into the functions.php file of your theme.

It'll stop WP to create additional image sizes and then you'll have only one copy of the image.

2. Without Coding: Install this plugin- Stop Generating Image Sizes and you are done.
Stop Generating Image Sizes
This plugin also allows you to choose which of the sizes you want to be prevented from creating.