←back to thread

2039 points Gadiguibou | 3 comments | | HN request time: 0.212s | source
1. reacharavindh ◴[] No.36492795[source]
Is there any easy shortcut to resizing an image by percentage or fitting to a specific size?

Many a times, a website says "file needs to be no bigger than 2 MB", and I need to scramble with Preview app to resize teh app until it falls below that limit. A cli tool for that action would be very handy.

replies(2): >>36492848 #>>36493744 #
2. itake ◴[] No.36492848[source]
I typically use https://www.digitalocean.com/community/tutorials/workflow-re...

You can even do bulk cmds with cli on images:

  for x in ls *.webp; do  ffmpeg -i $x ${x%.webp}.png; done
reformats images from webp to png in a directory.

  magick mogrify -monitor -format jpg *.png -compress 70
reformats and compresses pngs to be jpg in a directory
3. frankjr ◴[] No.36493744[source]
You can use ImageMagick's `convert`.

  convert original.jpg -define jpeg:extent=2MB output.jpg
The result will be around 2MB in size (in both directions).