added nautilus scripts (needs nautilus-python package)

This commit is contained in:
2026-06-14 18:55:25 +02:00
parent 33df2d0d81
commit dd4af575b5
247 changed files with 14784 additions and 0 deletions
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -colorspace gray -type palette "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -grayscale average "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -grayscale rec709luma "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
local suffix=1
for ((i = 100 + 30; i < 300; i += 30)); do
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve; par_suffix='($suffix)'")
std_output=$(convert "$input_file" -define modulate:colorspace=HSB -modulate "100,100,$i" "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
suffix=$((suffix + 1))
done
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_min_items=2; par_sort_list=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
_main_task "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_files=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "Animated image.gif" "$output_dir" "par_extension_opt=preserve")
# shellcheck disable=SC2086
std_output=$(convert -delay 100 -loop 0 $input_files "$output_file" 2>&1)
_check_output "$?" "$std_output" "" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_min_items=2; par_sort_list=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
_main_task "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_files=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "Combined images.pdf" "$output_dir" "par_extension_opt=preserve")
# shellcheck disable=SC2086
std_output=$(convert $input_files "$output_file" 2>&1)
_check_output "$?" "$std_output" "" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_min_items=2; par_sort_list=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
_main_task "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_files=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "Concatenated images.png" "$output_dir" "par_extension_opt=preserve")
# shellcheck disable=SC2086
std_output=$(convert $input_files +append +repage "$output_file" 2>&1)
_check_output "$?" "$std_output" "" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_min_items=2; par_sort_list=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
_main_task "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_files=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "Concatenated images.png" "$output_dir" "par_extension_opt=preserve")
# shellcheck disable=SC2086
std_output=$(convert $input_files -append +repage "$output_file" 2>&1)
_check_output "$?" "$std_output" "" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -crop 100%x50% +repage "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -crop 50%x100% +repage "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -crop 50%x50% +repage "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=bmp")
std_output=$(convert "$input_file" "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=gif")
std_output=$(convert "$input_file" "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=jpg")
std_output=$(convert "$input_file" "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png")
std_output=$(convert "$input_file" "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=tif")
std_output=$(convert "$input_file" "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=webp")
std_output=$(convert "$input_file" -auto-orient "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
+106
View File
@@ -0,0 +1,106 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies ""
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
local dependencies=""
dependencies=$(_get_dependencies "$input_files")
_check_dependencies "$dependencies"
_display_wait_box "2"
output_dir=$(_get_output_dir "par_use_same_dir=true")
export -f _get_command _run_command
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
# Run the main process.
local command=""
command=$(_get_command "$input_file")
_run_command "$input_file" "$command" "$output_dir"
}
_get_dependencies() {
local input_files=$1
local dependencies=""
# Check dependencies for each file.
for input_file in $input_files; do
local command=""
command=$(_get_command "$input_file")
case $command in
"convert")
dependencies+="
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick"
;;
"inkscape") dependencies+="command=inkscape" ;;
esac
dependencies+=$'\n'
done
printf "%s" "$dependencies"
}
_get_command() {
local input_file=$1
local command=""
case "${input_file,,}" in
*.svg | *.svgz) command="inkscape" ;;
*) command="convert" ;;
esac
printf "%s" "$command"
}
_run_command() {
local input_file=$1
local command=$2
local output_dir=$3
local output_format="pdf"
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=$output_format")
# Run the main process.
case $command in
"convert")
std_output=$(convert "$input_file" "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
;;
"inkscape")
local inkscape_version=""
local inkscape_version_old="1.0"
inkscape_version=$(inkscape --version | cut -d " " -f 2)
if [[ "$inkscape_version" == $(echo -e "$inkscape_version\n$inkscape_version_old" | sort -V | head -n1) ]]; then
# Old Inkscape version.
std_output=$(inkscape --without-gui --export-area-drawing --file="$input_file" --export-pdf="$output_file" 2>&1)
else
# New Inkscape version.
std_output=$(inkscape --export-area-drawing --export-filename="$output_file" -- "$input_file" 2>&1)
fi
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
;;
esac
}
_main "$@"
@@ -0,0 +1,112 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
local temp_file1=""
local temp_file2=""
local temp_file3=""
local temp_file4=""
local icon_size="128"
# Work on a temporary file.
temp_file1="$(_get_temp_file_dry).png"
temp_file2="$(_get_temp_file_dry).png"
temp_file3="$(_get_temp_file_dry).png"
temp_file4="$(_get_temp_file_dry).png"
# Run the process (part 0) 'export svg'.
local filename_extension=""
local input_file_proc=""
filename_extension=$(_get_filename_extension "$input_file")
if [[ "${filename_extension,,}" == ".svg"* ]]; then
local inkscape_version=""
local inkscape_version_old="1.0"
inkscape_version=$(inkscape --version | cut -d " " -f 2)
if [[ "$inkscape_version" == $(echo -e "$inkscape_version\n$inkscape_version_old" | sort -V | head -n1) ]]; then
# Old Inkscape version.
std_output=$(inkscape --without-gui --export-area-drawing --file="$input_file" --export-height=$((icon_size * 2)) --export-png="$temp_file4" 2>&1)
else
# New Inkscape version.
std_output=$(inkscape --export-area-drawing --export-height=$((icon_size * 2)) --export-filename="$temp_file4" -- "$input_file" 2>&1)
fi
_check_output "$?" "$std_output" "$input_file" "$temp_file4" || return 1
input_file_proc=$temp_file4
else
input_file_proc=$input_file
fi
# Run the process (part 1) 'get information of the image'.
local first_pixel_color=""
first_pixel_color=$(convert "$input_file_proc" -format "%[pixel:p{0,0}]" "info:" 2>&1)
_check_output "$?" "$std_output" "$input_file" "" || return 1
local last_pixel=""
last_pixel=$(identify -format "%[fx:w-1],0" "$input_file_proc" 2>&1)
_check_output "$?" "$std_output" "$input_file" "" || return 1
local last_pixel_color=""
last_pixel_color=$(convert "$input_file_proc" -format "%[pixel:p{$last_pixel}]" "info:")
_check_output "$?" "$std_output" "$input_file" "" || return 1
if [[ "$first_pixel_color" == "$last_pixel_color" ]]; then
# Run the process (part 2) 'automatic crop the content'.
std_output=$(convert "$input_file_proc" -trim +repage "$temp_file1" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file1" || return 1
# Run the process (part 3) 'extend to square'.
std_output=$(convert "$temp_file1" -set option:distort:viewport "%[fx:max(w,h)]x%[fx:max(w,h)]+%[fx:(w-max(w,h))/2]+%[fx:(h-max(w,h))/2]" -virtual-pixel transparent -filter point -distort SRT 0 -bordercolor "$first_pixel_color" -border 1 -fill "$first_pixel_color" -draw "color 0,0 floodfill" -shave 1 -draw "color 0,0 floodfill" +repage "$temp_file2" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file2" || return 1
# Run the process (part 4) 'extend 14%' to add a border.
local factor="1.14"
std_output=$(convert "$temp_file2" -set option:distort:viewport "%[fx:(w*$factor)]x%[fx:(h*$factor)]+%[fx:(w-(w*$factor))/2]+%[fx:(h-(h*$factor))/2]" -virtual-pixel transparent -filter point -distort SRT 0 -bordercolor "$first_pixel_color" -border 1 -fill "$first_pixel_color" -draw "color 0,0 floodfill" -shave 1 -draw "color 0,0 floodfill" +repage "$temp_file3" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file3" || return 1
input_file_proc=$temp_file3
fi
# Run the process (part 5) 'resize and crop the final image' to add a border.
std_output=$(convert "$input_file_proc" -resize "${icon_size}x${icon_size}^" -gravity center -crop ${icon_size}x${icon_size}+0+0 -strip +repage "$temp_file4" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file4" || return 1
# Move the temporary file to the output.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png")
_move_temp_file_to_output "$input_file" "$temp_file4" "$output_file"
# Remove the temporary files on each iteration (if not removed before).
rm -f -- "$temp_file1"
rm -f -- "$temp_file2"
rm -f -- "$temp_file3"
rm -f -- "$temp_file4"
}
_main "$@"
@@ -0,0 +1,112 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
local temp_file1=""
local temp_file2=""
local temp_file3=""
local temp_file4=""
local icon_size="256"
# Work on a temporary file.
temp_file1="$(_get_temp_file_dry).png"
temp_file2="$(_get_temp_file_dry).png"
temp_file3="$(_get_temp_file_dry).png"
temp_file4="$(_get_temp_file_dry).png"
# Run the process (part 0) 'export svg'.
local filename_extension=""
local input_file_proc=""
filename_extension=$(_get_filename_extension "$input_file")
if [[ "${filename_extension,,}" == ".svg"* ]]; then
local inkscape_version=""
local inkscape_version_old="1.0"
inkscape_version=$(inkscape --version | cut -d " " -f 2)
if [[ "$inkscape_version" == $(echo -e "$inkscape_version\n$inkscape_version_old" | sort -V | head -n1) ]]; then
# Old Inkscape version.
std_output=$(inkscape --without-gui --export-area-drawing --file="$input_file" --export-height=$((icon_size * 2)) --export-png="$temp_file4" 2>&1)
else
# New Inkscape version.
std_output=$(inkscape --export-area-drawing --export-height=$((icon_size * 2)) --export-filename="$temp_file4" -- "$input_file" 2>&1)
fi
_check_output "$?" "$std_output" "$input_file" "$temp_file4" || return 1
input_file_proc=$temp_file4
else
input_file_proc=$input_file
fi
# Run the process (part 1) 'get information of the image'.
local first_pixel_color=""
first_pixel_color=$(convert "$input_file_proc" -format "%[pixel:p{0,0}]" "info:" 2>&1)
_check_output "$?" "$std_output" "$input_file" "" || return 1
local last_pixel=""
last_pixel=$(identify -format "%[fx:w-1],0" "$input_file_proc" 2>&1)
_check_output "$?" "$std_output" "$input_file" "" || return 1
local last_pixel_color=""
last_pixel_color=$(convert "$input_file_proc" -format "%[pixel:p{$last_pixel}]" "info:")
_check_output "$?" "$std_output" "$input_file" "" || return 1
if [[ "$first_pixel_color" == "$last_pixel_color" ]]; then
# Run the process (part 2) 'automatic crop the content'.
std_output=$(convert "$input_file_proc" -trim +repage "$temp_file1" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file1" || return 1
# Run the process (part 3) 'extend to square'.
std_output=$(convert "$temp_file1" -set option:distort:viewport "%[fx:max(w,h)]x%[fx:max(w,h)]+%[fx:(w-max(w,h))/2]+%[fx:(h-max(w,h))/2]" -virtual-pixel transparent -filter point -distort SRT 0 -bordercolor "$first_pixel_color" -border 1 -fill "$first_pixel_color" -draw "color 0,0 floodfill" -shave 1 -draw "color 0,0 floodfill" +repage "$temp_file2" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file2" || return 1
# Run the process (part 4) 'extend 14%' to add a border.
local factor="1.14"
std_output=$(convert "$temp_file2" -set option:distort:viewport "%[fx:(w*$factor)]x%[fx:(h*$factor)]+%[fx:(w-(w*$factor))/2]+%[fx:(h-(h*$factor))/2]" -virtual-pixel transparent -filter point -distort SRT 0 -bordercolor "$first_pixel_color" -border 1 -fill "$first_pixel_color" -draw "color 0,0 floodfill" -shave 1 -draw "color 0,0 floodfill" +repage "$temp_file3" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file3" || return 1
input_file_proc=$temp_file3
fi
# Run the process (part 5) 'resize and crop the final image' to add a border.
std_output=$(convert "$input_file_proc" -resize "${icon_size}x${icon_size}^" -gravity center -crop ${icon_size}x${icon_size}+0+0 -strip +repage "$temp_file4" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file4" || return 1
# Move the temporary file to the output.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png")
_move_temp_file_to_output "$input_file" "$temp_file4" "$output_file"
# Remove the temporary files on each iteration (if not removed before).
rm -f -- "$temp_file1"
rm -f -- "$temp_file2"
rm -f -- "$temp_file3"
rm -f -- "$temp_file4"
}
_main "$@"
@@ -0,0 +1,112 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
local temp_file1=""
local temp_file2=""
local temp_file3=""
local temp_file4=""
local icon_size="512"
# Work on a temporary file.
temp_file1="$(_get_temp_file_dry).png"
temp_file2="$(_get_temp_file_dry).png"
temp_file3="$(_get_temp_file_dry).png"
temp_file4="$(_get_temp_file_dry).png"
# Run the process (part 0) 'export svg'.
local filename_extension=""
local input_file_proc=""
filename_extension=$(_get_filename_extension "$input_file")
if [[ "${filename_extension,,}" == ".svg"* ]]; then
local inkscape_version=""
local inkscape_version_old="1.0"
inkscape_version=$(inkscape --version | cut -d " " -f 2)
if [[ "$inkscape_version" == $(echo -e "$inkscape_version\n$inkscape_version_old" | sort -V | head -n1) ]]; then
# Old Inkscape version.
std_output=$(inkscape --without-gui --export-area-drawing --file="$input_file" --export-height=$((icon_size * 2)) --export-png="$temp_file4" 2>&1)
else
# New Inkscape version.
std_output=$(inkscape --export-area-drawing --export-height=$((icon_size * 2)) --export-filename="$temp_file4" -- "$input_file" 2>&1)
fi
_check_output "$?" "$std_output" "$input_file" "$temp_file4" || return 1
input_file_proc=$temp_file4
else
input_file_proc=$input_file
fi
# Run the process (part 1) 'get information of the image'.
local first_pixel_color=""
first_pixel_color=$(convert "$input_file_proc" -format "%[pixel:p{0,0}]" "info:" 2>&1)
_check_output "$?" "$std_output" "$input_file" "" || return 1
local last_pixel=""
last_pixel=$(identify -format "%[fx:w-1],0" "$input_file_proc" 2>&1)
_check_output "$?" "$std_output" "$input_file" "" || return 1
local last_pixel_color=""
last_pixel_color=$(convert "$input_file_proc" -format "%[pixel:p{$last_pixel}]" "info:")
_check_output "$?" "$std_output" "$input_file" "" || return 1
if [[ "$first_pixel_color" == "$last_pixel_color" ]]; then
# Run the process (part 2) 'automatic crop the content'.
std_output=$(convert "$input_file_proc" -trim +repage "$temp_file1" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file1" || return 1
# Run the process (part 3) 'extend to square'.
std_output=$(convert "$temp_file1" -set option:distort:viewport "%[fx:max(w,h)]x%[fx:max(w,h)]+%[fx:(w-max(w,h))/2]+%[fx:(h-max(w,h))/2]" -virtual-pixel transparent -filter point -distort SRT 0 -bordercolor "$first_pixel_color" -border 1 -fill "$first_pixel_color" -draw "color 0,0 floodfill" -shave 1 -draw "color 0,0 floodfill" +repage "$temp_file2" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file2" || return 1
# Run the process (part 4) 'extend 14%' to add a border.
local factor="1.14"
std_output=$(convert "$temp_file2" -set option:distort:viewport "%[fx:(w*$factor)]x%[fx:(h*$factor)]+%[fx:(w-(w*$factor))/2]+%[fx:(h-(h*$factor))/2]" -virtual-pixel transparent -filter point -distort SRT 0 -bordercolor "$first_pixel_color" -border 1 -fill "$first_pixel_color" -draw "color 0,0 floodfill" -shave 1 -draw "color 0,0 floodfill" +repage "$temp_file3" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file3" || return 1
input_file_proc=$temp_file3
fi
# Run the process (part 5) 'resize and crop the final image' to add a border.
std_output=$(convert "$input_file_proc" -resize "${icon_size}x${icon_size}^" -gravity center -crop ${icon_size}x${icon_size}+0+0 -strip +repage "$temp_file4" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file4" || return 1
# Move the temporary file to the output.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png")
_move_temp_file_to_output "$input_file" "$temp_file4" "$output_file"
# Remove the temporary files on each iteration (if not removed before).
rm -f -- "$temp_file1"
rm -f -- "$temp_file2"
rm -f -- "$temp_file3"
rm -f -- "$temp_file4"
}
_main "$@"
@@ -0,0 +1,112 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
local temp_file1=""
local temp_file2=""
local temp_file3=""
local temp_file4=""
local icon_size="64"
# Work on a temporary file.
temp_file1="$(_get_temp_file_dry).png"
temp_file2="$(_get_temp_file_dry).png"
temp_file3="$(_get_temp_file_dry).png"
temp_file4="$(_get_temp_file_dry).png"
# Run the process (part 0) 'export svg'.
local filename_extension=""
local input_file_proc=""
filename_extension=$(_get_filename_extension "$input_file")
if [[ "${filename_extension,,}" == ".svg"* ]]; then
local inkscape_version=""
local inkscape_version_old="1.0"
inkscape_version=$(inkscape --version | cut -d " " -f 2)
if [[ "$inkscape_version" == $(echo -e "$inkscape_version\n$inkscape_version_old" | sort -V | head -n1) ]]; then
# Old Inkscape version.
std_output=$(inkscape --without-gui --export-area-drawing --file="$input_file" --export-height=$((icon_size * 2)) --export-png="$temp_file4" 2>&1)
else
# New Inkscape version.
std_output=$(inkscape --export-area-drawing --export-height=$((icon_size * 2)) --export-filename="$temp_file4" -- "$input_file" 2>&1)
fi
_check_output "$?" "$std_output" "$input_file" "$temp_file4" || return 1
input_file_proc=$temp_file4
else
input_file_proc=$input_file
fi
# Run the process (part 1) 'get information of the image'.
local first_pixel_color=""
first_pixel_color=$(convert "$input_file_proc" -format "%[pixel:p{0,0}]" "info:" 2>&1)
_check_output "$?" "$std_output" "$input_file" "" || return 1
local last_pixel=""
last_pixel=$(identify -format "%[fx:w-1],0" "$input_file_proc" 2>&1)
_check_output "$?" "$std_output" "$input_file" "" || return 1
local last_pixel_color=""
last_pixel_color=$(convert "$input_file_proc" -format "%[pixel:p{$last_pixel}]" "info:")
_check_output "$?" "$std_output" "$input_file" "" || return 1
if [[ "$first_pixel_color" == "$last_pixel_color" ]]; then
# Run the process (part 2) 'automatic crop the content'.
std_output=$(convert "$input_file_proc" -trim +repage "$temp_file1" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file1" || return 1
# Run the process (part 3) 'extend to square'.
std_output=$(convert "$temp_file1" -set option:distort:viewport "%[fx:max(w,h)]x%[fx:max(w,h)]+%[fx:(w-max(w,h))/2]+%[fx:(h-max(w,h))/2]" -virtual-pixel transparent -filter point -distort SRT 0 -bordercolor "$first_pixel_color" -border 1 -fill "$first_pixel_color" -draw "color 0,0 floodfill" -shave 1 -draw "color 0,0 floodfill" +repage "$temp_file2" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file2" || return 1
# Run the process (part 4) 'extend 14%' to add a border.
local factor="1.14"
std_output=$(convert "$temp_file2" -set option:distort:viewport "%[fx:(w*$factor)]x%[fx:(h*$factor)]+%[fx:(w-(w*$factor))/2]+%[fx:(h-(h*$factor))/2]" -virtual-pixel transparent -filter point -distort SRT 0 -bordercolor "$first_pixel_color" -border 1 -fill "$first_pixel_color" -draw "color 0,0 floodfill" -shave 1 -draw "color 0,0 floodfill" +repage "$temp_file3" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file3" || return 1
input_file_proc=$temp_file3
fi
# Run the process (part 5) 'resize and crop the final image' to add a border.
std_output=$(convert "$input_file_proc" -resize "${icon_size}x${icon_size}^" -gravity center -crop ${icon_size}x${icon_size}+0+0 -strip +repage "$temp_file4" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file4" || return 1
# Move the temporary file to the output.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png")
_move_temp_file_to_output "$input_file" "$temp_file4" "$output_file"
# Remove the temporary files on each iteration (if not removed before).
rm -f -- "$temp_file1"
rm -f -- "$temp_file2"
rm -f -- "$temp_file3"
rm -f -- "$temp_file4"
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -trim +repage "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -fuzz 15% -trim +repage "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -resize 25%x25% +repage "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -resize 50%x50% +repage "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -resize 75%x75% +repage "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -resize "1920x1080^" -gravity center -crop 1920x1080+0+0 -strip +repage "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -transparent none -flop "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -transparent none -flip "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -transparent none -rotate 180 +repage "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -transparent none -rotate 270 +repage "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -transparent none -rotate 90 +repage "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
# Execute initial checks.
_check_dependencies "command=findimagedupes | command=xdg-open; package=xdg-utils"
_display_wait_box "0"
input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime=image/")
# Get the installed image viewer.
local image_viewer=""
image_viewer=$(_xdg_get_default_app "image/jpeg")
# Run the main process.
# shellcheck disable=SC2086
findimagedupes --recurse --threshold=65% --program="$(which "$image_viewer")" -- $input_files 2>/dev/null
_display_result_box ""
}
_main "$@"
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
# Execute initial checks.
_check_dependencies "command=findimagedupes | command=xdg-open; package=xdg-utils"
_display_wait_box "0"
input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime=image/")
# Get the installed image viewer.
local image_viewer=""
image_viewer=$(_xdg_get_default_app "image/jpeg")
# Run the main process.
# shellcheck disable=SC2086
findimagedupes --recurse --threshold=75% --program="$(which "$image_viewer")" -- $input_files 2>/dev/null
_display_result_box ""
}
_main "$@"
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
# Execute initial checks.
_check_dependencies "command=findimagedupes | command=xdg-open; package=xdg-utils"
_display_wait_box "0"
input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime=image/")
# Get the installed image viewer.
local image_viewer=""
image_viewer=$(_xdg_get_default_app "image/jpeg")
# Run the main process.
# shellcheck disable=SC2086
findimagedupes --recurse --threshold=85% --program="$(which "$image_viewer")" -- $input_files 2>/dev/null
_display_result_box ""
}
_main "$@"
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
# Execute initial checks.
_check_dependencies "command=findimagedupes | command=xdg-open; package=xdg-utils"
_display_wait_box "0"
input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime=image/")
# Get the installed image viewer.
local image_viewer=""
image_viewer=$(_xdg_get_default_app "image/jpeg")
# Run the main process.
# shellcheck disable=SC2086
findimagedupes --recurse --threshold=95% --program="$(which "$image_viewer")" -- $input_files 2>/dev/null
_display_result_box ""
}
_main "$@"
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "command=jpegoptim"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(jpegoptim --strip-all --dest="$output_dir" -- "$input_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,35 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "command=optipng"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(optipng -out "$output_file" -- "$input_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
TEMP_DATA_TASK="eng"
_check_dependencies "
pkg_manager=apt; package=tesseract-ocr-$TEMP_DATA_TASK |
pkg_manager=dnf; package=tesseract-langpack-$TEMP_DATA_TASK |
pkg_manager=pacman; package=tesseract-data-$TEMP_DATA_TASK |
pkg_manager=zypper; package=tesseract-ocr-traineddata-$TEMP_DATA_TASK"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
local temp_file=""
# Work on a temporary file.
temp_file=$(_get_temp_file)
# Run the main process.
std_output=$(tesseract "$input_file" "$temp_file" -l "$TEMP_DATA_TASK" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file.txt" || return 1
# Move the temporary file to the output.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=txt")
_move_temp_file_to_output "$input_file" "$temp_file.txt" "$output_file"
# Remove the temporary files on each iteration (if not removed before).
rm -f -- "$temp_file"
}
_main "$@"
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
TEMP_DATA_TASK="fra"
_check_dependencies "
pkg_manager=apt; package=tesseract-ocr-$TEMP_DATA_TASK |
pkg_manager=dnf; package=tesseract-langpack-$TEMP_DATA_TASK |
pkg_manager=pacman; package=tesseract-data-$TEMP_DATA_TASK |
pkg_manager=zypper; package=tesseract-ocr-traineddata-$TEMP_DATA_TASK"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
local temp_file=""
# Work on a temporary file.
temp_file=$(_get_temp_file)
# Run the main process.
std_output=$(tesseract "$input_file" "$temp_file" -l "$TEMP_DATA_TASK" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file.txt" || return 1
# Move the temporary file to the output.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=txt")
_move_temp_file_to_output "$input_file" "$temp_file.txt" "$output_file"
# Remove the temporary files on each iteration (if not removed before).
rm -f -- "$temp_file"
}
_main "$@"
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
TEMP_DATA_TASK="deu"
_check_dependencies "
pkg_manager=apt; package=tesseract-ocr-$TEMP_DATA_TASK |
pkg_manager=dnf; package=tesseract-langpack-$TEMP_DATA_TASK |
pkg_manager=pacman; package=tesseract-data-$TEMP_DATA_TASK |
pkg_manager=zypper; package=tesseract-ocr-traineddata-$TEMP_DATA_TASK"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
local temp_file=""
# Work on a temporary file.
temp_file=$(_get_temp_file)
# Run the main process.
std_output=$(tesseract "$input_file" "$temp_file" -l "$TEMP_DATA_TASK" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file.txt" || return 1
# Move the temporary file to the output.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=txt")
_move_temp_file_to_output "$input_file" "$temp_file.txt" "$output_file"
# Remove the temporary files on each iteration (if not removed before).
rm -f -- "$temp_file"
}
_main "$@"
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
TEMP_DATA_TASK="ita"
_check_dependencies "
pkg_manager=apt; package=tesseract-ocr-$TEMP_DATA_TASK |
pkg_manager=dnf; package=tesseract-langpack-$TEMP_DATA_TASK |
pkg_manager=pacman; package=tesseract-data-$TEMP_DATA_TASK |
pkg_manager=zypper; package=tesseract-ocr-traineddata-$TEMP_DATA_TASK"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
local temp_file=""
# Work on a temporary file.
temp_file=$(_get_temp_file)
# Run the main process.
std_output=$(tesseract "$input_file" "$temp_file" -l "$TEMP_DATA_TASK" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file.txt" || return 1
# Move the temporary file to the output.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=txt")
_move_temp_file_to_output "$input_file" "$temp_file.txt" "$output_file"
# Remove the temporary files on each iteration (if not removed before).
rm -f -- "$temp_file"
}
_main "$@"
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
TEMP_DATA_TASK="por"
_check_dependencies "
pkg_manager=apt; package=tesseract-ocr-$TEMP_DATA_TASK |
pkg_manager=dnf; package=tesseract-langpack-$TEMP_DATA_TASK |
pkg_manager=pacman; package=tesseract-data-$TEMP_DATA_TASK |
pkg_manager=zypper; package=tesseract-ocr-traineddata-$TEMP_DATA_TASK"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
local temp_file=""
# Work on a temporary file.
temp_file=$(_get_temp_file)
# Run the main process.
std_output=$(tesseract "$input_file" "$temp_file" -l "$TEMP_DATA_TASK" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file.txt" || return 1
# Move the temporary file to the output.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=txt")
_move_temp_file_to_output "$input_file" "$temp_file.txt" "$output_file"
# Remove the temporary files on each iteration (if not removed before).
rm -f -- "$temp_file"
}
_main "$@"
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
TEMP_DATA_TASK="rus"
_check_dependencies "
pkg_manager=apt; package=tesseract-ocr-$TEMP_DATA_TASK |
pkg_manager=dnf; package=tesseract-langpack-$TEMP_DATA_TASK |
pkg_manager=pacman; package=tesseract-data-$TEMP_DATA_TASK |
pkg_manager=zypper; package=tesseract-ocr-traineddata-$TEMP_DATA_TASK"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
local temp_file=""
# Work on a temporary file.
temp_file=$(_get_temp_file)
# Run the main process.
std_output=$(tesseract "$input_file" "$temp_file" -l "$TEMP_DATA_TASK" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file.txt" || return 1
# Move the temporary file to the output.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=txt")
_move_temp_file_to_output "$input_file" "$temp_file.txt" "$output_file"
# Remove the temporary files on each iteration (if not removed before).
rm -f -- "$temp_file"
}
_main "$@"
@@ -0,0 +1,50 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
TEMP_DATA_TASK="spa"
_check_dependencies "
pkg_manager=apt; package=tesseract-ocr-$TEMP_DATA_TASK |
pkg_manager=dnf; package=tesseract-langpack-$TEMP_DATA_TASK |
pkg_manager=pacman; package=tesseract-data-$TEMP_DATA_TASK |
pkg_manager=zypper; package=tesseract-ocr-traineddata-$TEMP_DATA_TASK"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=true")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
local temp_file=""
# Work on a temporary file.
temp_file=$(_get_temp_file)
# Run the main process.
std_output=$(tesseract "$input_file" "$temp_file" -l "$TEMP_DATA_TASK" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$temp_file.txt" || return 1
# Move the temporary file to the output.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=txt")
_move_temp_file_to_output "$input_file" "$temp_file.txt" "$output_file"
# Remove the temporary files on each iteration (if not removed before).
rm -f -- "$temp_file"
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -background black -layers flatten "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -background magenta -layers flatten "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve")
std_output=$(convert "$input_file" -background white -layers flatten "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
local first_pixel_color=""
first_pixel_color=$(convert "$input_file""[1x1+0+0]" -format "%[pixel:p{0,0}]" "info:")
_check_output "$?" "$std_output" "$input_file" "" || return 1
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png")
std_output=$(convert "$input_file" -alpha off -bordercolor "$first_pixel_color" -border 1 \( +clone -fill none -floodfill +0+0 "$first_pixel_color" -alpha extract -geometry 200% -blur 0x0.5 -morphology erode square:1 -geometry 50% \) -compose CopyOpacity -composite -shave 1 "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
local first_pixel_color=""
first_pixel_color=$(convert "$input_file""[1x1+0+0]" -format "%[pixel:p{0,0}]" "info:")
_check_output "$?" "$std_output" "$input_file" "" || return 1
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png")
std_output=$(convert "$input_file" -alpha off -bordercolor "$first_pixel_color" -border 1 \( +clone -fuzz 15% -fill none -floodfill +0+0 "$first_pixel_color" -alpha extract -geometry 200% -blur 0x0.5 -morphology erode square:1 -geometry 50% \) -compose CopyOpacity -composite -shave 1 "$output_file" 2>&1)
_check_output "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png")
std_output=$(convert "$input_file" -transparent black "$output_file" 2>&1)
_check_result "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png")
std_output=$(convert "$input_file" -fuzz 10% -transparent black "$output_file" 2>&1)
_check_result "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png")
std_output=$(convert "$input_file" -transparent magenta "$output_file" 2>&1)
_check_result "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png")
std_output=$(convert "$input_file" -fuzz 10% -transparent magenta "$output_file" 2>&1)
_check_result "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png")
std_output=$(convert "$input_file" -transparent white "$output_file" 2>&1)
_check_result "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
# Source the script 'common-functions.sh'.
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR")
source "$ROOT_DIR/common-functions.sh"
_main() {
local input_files=""
local output_dir=""
# Execute initial checks.
_check_dependencies "
command=convert; pkg_manager=apt; package=imagemagick |
command=convert; pkg_manager=dnf; package=ImageMagick |
command=convert; pkg_manager=pacman; package=imagemagick |
command=convert; pkg_manager=zypper; package=ImageMagick"
_display_wait_box "2"
input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true")
output_dir=$(_get_output_dir "par_use_same_dir=false")
# Execute the function '_main_task' for each file in parallel.
_run_task_parallel "$input_files" "$output_dir"
_display_result_box "$output_dir"
}
_main_task() {
local input_file=$1
local output_dir=$2
local output_file=""
local std_output=""
# Run the main process.
output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png")
std_output=$(convert "$input_file" -fuzz 10% -transparent white "$output_file" 2>&1)
_check_result "$?" "$std_output" "$input_file" "$output_file" || return 1
}
_main "$@"