Skip to content
  • Home
  • WHOAMI
  • How-tos

G.Melikov's blog

Month: June 2017

how-to June 3, 2017January 6, 2019 by gmelikov

Add audio file to mkv

mkvmerge -o output-with-sound.mkv -A input-video.mkv soundfile.mp3
Continue Reading
how-to June 1, 2017January 6, 2019 by gmelikov

Batch lossless optimize images in Linux, Mac OS and Windows

Linux and Mac OS:

find . -iname '*.png' -exec optipng -o7 -strip all "{}" \;
find . -iregex '.*\.\(jpg\|jpeg\|jpe\|jif|jfif|jfi\)$' -exec jpegoptim --all-progressive --strip-all --strip-com --strip-exif --strip-iptc --strip-icc "{}" \;
Continue Reading
how-to June 1, 2017January 6, 2019 by gmelikov

Batch resize images with different sizes for each orientation in Linux, Mac OS and Windows

#!/bin/bash
I=0
for f in *.jpg
do
(( I++ ))
r=$(printf "%03d" $I)
   read w h <<< $(convert "$f" -ping -format "%w %h" info: )
   if [ $w -gt $h ]; then
      echo "$f is $h tall and $w wide (landscape)"
	  convert "$f[800x>]" $r.jpg
   else
      echo "$f is $h tall and $w wide (portrait)"
	  convert "$f[395x>]" $r.jpg
   fi
done
Continue Reading

Recent Posts

  • Linux network: reply on same interface as incoming
  • Debian Stretch diskless machine via PXE boot
  • Add audio file to mkv
  • Batch lossless optimize images in Linux, Mac OS and Windows
  • Batch resize images with different sizes for each orientation in Linux, Mac OS and Windows

Recent Comments

  • gmelikov on Change a File’s Last Modified and Creation Dates on Mac OS X and Linux
  • gmelikov on Debian Stretch diskless machine via PXE boot
  • Francesco on Debian Stretch diskless machine via PXE boot
  • Sam on Change a File’s Last Modified and Creation Dates on Mac OS X and Linux
  • D on Change a File’s Last Modified and Creation Dates on Mac OS X and Linux

Archives

  • February 2018
  • June 2017
  • December 2016

Categories

  • how-to

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Copyright © 2023 G.Melikov's blog – Designed & Developed by ZThemes.