Here's a scenario I encounter pretty often:
- I download an image from Unsplash
- I move the image into the folder of a webapp
- The image is like 1GB because it's so high quality, and that's no good for download speeds from the webapp
- I need to resize it to make it smaller.
You could open up a GUI to resize the image (preview on MacOS works really well for this).. but sometimes I just want to stay in teh terminal.
The tool to solve the problem in the terminal is ImageMagick.
There are two commands I typically use. The first is
identify <image> which will tell you the current width & height of the image.
The second I use is
convert <source_image> -resize 1000x <destination_image>. This will resize the source image to a width of 1000px, and will maintain the aspect ratio for the height.
There's a lot more you can do with ImageMagick tools. If you know some tricks, let everyone know in teh comments!
Hopefully this is useful for you. If you're looking for more tips on Linux & development, follow me here on dev.to or on Twitter @connorbode.