DEV Community

Connor Bode
Connor Bode

Posted on

3 2

Image Resizing from the shell

Here's a scenario I encounter pretty often:

  1. I download an image from Unsplash
  2. I move the image into the folder of a webapp
  3. The image is like 1GB because it's so high quality, and that's no good for download speeds from the webapp
  4. 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.

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay