Skip to content

Instantly share code, notes, and snippets.

@lineharo
Last active April 10, 2019 06:26
Show Gist options
  • Save lineharo/44e1dbba71c7e39ae11f9763c79e11ae to your computer and use it in GitHub Desktop.
Save lineharo/44e1dbba71c7e39ae11f9763c79e11ae to your computer and use it in GitHub Desktop.
Обрезка и оптимизация изображений (jpeg) - batch for Windows with ImageMagick & JpegTran
rem Преобразовывает все изображения в 1024*768 и 285х200 + оптимизирует их
rem Нужны программы: ImageMagick (https://www.imagemagick.org/script/download.php) и jpegtran (http://jpegclub.org/jpegtran/)
for %%f in (*.jpg) do (
magick %%f -resize "285x200^" -gravity center -extent 285x200 "%%~nf-thumb.jpg"
jpegtran -copy none -optimize -progressive -outfile "%%~nf-thumb.jpg" "%%~nf-thumb.jpg"
magick %%f -resize "1024x768<" -gravity center -extent 1024x768 "%%~nf-view.jpg"
jpegtran -copy none -optimize -outfile "%%~nf-view.jpg" "%%~nf-view.jpg"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment