Skip to content

Commit

Permalink
Add image resizing with defaults.
Browse files Browse the repository at this point in the history
  • Loading branch information
eshrh committed Mar 16, 2021
1 parent 4d36a85 commit 5baad57
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ames.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ OUTPUT_MONITOR=""
AUDIO_BITRATE="64k"
AUDIO_FORMAT="opus"
IMAGE_FORMAT="webp"
# -2 to calculate dimension while preserving aspect ratio.
IMAGE_WIDTH="-2"
IMAGE_HEIGHT="300"

CONFIG_FILE_PATH="$HOME/.config/ames/config"

Expand Down Expand Up @@ -167,6 +170,7 @@ screenshot() {
-hide_banner \
-loglevel error \
-i "$path" \
-vf scale="$IMAGE_WIDTH:$IMAGE_HEIGHT" \
"$converted_path"

rm "$path"
Expand All @@ -186,6 +190,7 @@ again() {
-hide_banner \
-loglevel error \
-i "$path" \
-vf scale="$IMAGE_WIDTH:$IMAGE_HEIGHT" \
"$converted_path"

rm "$path"
Expand All @@ -206,10 +211,11 @@ screenshot_window() {
ffmpeg -nostdin \
-hide_banner \
-loglevel error \
-i "$path" "/tmp/$(basename -- "$path" | cut -d "." -f-2).$IMAGE_FORMAT"
-i "$path" \
-vf scale="$IMAGE_WIDTH:$IMAGE_HEIGHT" \
"$converted_path"

rm "$path"

store_file "$converted_path"
update_img "$(basename -- "$converted_path")"
notify_screenshot_add
Expand Down
3 changes: 3 additions & 0 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ OUTPUT_MONITOR=""
AUDIO_BITRATE="64k"
AUDIO_FORMAT="opus"
IMAGE_FORMAT="webp"
# -2 to calculate dimension while preserving aspect ratio.
IMAGE_WIDTH="-2"
IMAGE_HEIGHT="300"

0 comments on commit 5baad57

Please sign in to comment.