mirror of
https://github.com/dylanaraps/neofetch.git
synced 2025-10-04 01:00:17 +00:00
image: Simplify crop
This commit is contained in:
26
neofetch
26
neofetch
@@ -2692,7 +2692,7 @@ get_image_size() {
|
|||||||
|
|
||||||
make_thumbnail() {
|
make_thumbnail() {
|
||||||
# Name the thumbnail using variables so we can use it later.
|
# Name the thumbnail using variables so we can use it later.
|
||||||
image_name="$crop_mode-$crop_offset-$width-$height-${image##*/}"
|
image_name="$image_size-$crop_offset-$width-$height-${image##*/}"
|
||||||
|
|
||||||
# Handle file extensions.
|
# Handle file extensions.
|
||||||
case "${image##*.}" in
|
case "${image##*.}" in
|
||||||
@@ -2705,21 +2705,15 @@ make_thumbnail() {
|
|||||||
mkdir -p "$thumbnail_dir"
|
mkdir -p "$thumbnail_dir"
|
||||||
|
|
||||||
if [[ ! -f "$thumbnail_dir/$image_name" ]]; then
|
if [[ ! -f "$thumbnail_dir/$image_name" ]]; then
|
||||||
case "$image_size" in
|
convert \
|
||||||
"square")
|
"$image" \
|
||||||
convert \
|
-strip \
|
||||||
"$image" \
|
-quality 50 \
|
||||||
-strip \
|
-gravity "$crop_offset" \
|
||||||
-quality 50 \
|
-background none \
|
||||||
-gravity "$crop_offset" \
|
-sample "$width"x"$height"^ \
|
||||||
-background none \
|
-extent "$width"x"$height" \
|
||||||
-sample "$width"x"$height"^ \
|
"$thumbnail_dir/$image_name"
|
||||||
-extent "$width"x"$height" \
|
|
||||||
"$thumbnail_dir/$image_name"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*) cp "$image" "$thumbnail_dir/$image_name" ;;
|
|
||||||
esac
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
image="$thumbnail_dir/$image_name"
|
image="$thumbnail_dir/$image_name"
|
||||||
|
Reference in New Issue
Block a user