Skip to content

Instantly share code, notes, and snippets.

@midnai
Created June 26, 2019 23:54
Show Gist options
  • Save midnai/0512a89b12e74026757f5eab0c633cbd to your computer and use it in GitHub Desktop.
Save midnai/0512a89b12e74026757f5eab0c633cbd to your computer and use it in GitHub Desktop.
// Crop imagenes, las imagenes tienen buena resolucion pero no tienen un estandar en los anchos altos
// Se necesita imagenes cuadradas, actualmente la mayoria tienen espacio a los costados
// Paso 1, escalar todas los altos de todas las imagenes, el ancho debe ser proporcional
// Paso 2, reprocesar las imagenes escaladas posicionarse al centro con -gravity center, y tomar 2400px
// la imagen quedara cuadrada (rescalada)
// Se usa ImageMagick en macbook (Instalar con Brew: brew instal imagemagick)
// Se usan los siguientes comandos:
// (modificar los folderes a requerimiento, las imagenes procesadas se generan con el mismo nombre)
$ magick 'original/*.jpg' -quality 100 -set filename:f '%t' -scale x2400 x2400/'%[filename:f].jpg'
$ magick 'x2400/*.jpg' -quality 95 -set filename:f '%t' -gravity center -crop 2400x2400+0+0 x2400x2400V2/'%[filename:f].jpg'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment