You don't need a third-party module for this. Assuming the image is part of the content, Drupal comes with Image Styles which allows you to alter on-the-fly how an image is rendered. See the Adding and Changing Styles section of the linked document for more details.
In summary, go to Administration > Configuration > Media > Image styles. Then you define a style. You'll most likely need the "scale" effect for this. Set width to 100 and leave height blank to preserve the ratio. Then save. Then on whatever you are using to configure rendering of content (manage display, panels, views, etc.), set the formatter of the image to render the image, and to use the style you just defined (by default, this is the setting with the Original value).
If you mean to do this programmatically, you can call the style directly using
theme. See this answer for more details on how to do that.
Under the hood, Drupal will take the image, resize it using whatever toolkit is configured (by default it's GD) to whatever the image style defined. It does not alter the original image, but creates a copy. A quick way to know if this is working is if you inspect the image and see that the url has the name of the image style.