Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usernob #5

Merged
merged 3 commits into from
Mar 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 74 additions & 1 deletion awesomeshot
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ hex_color=(
"#A8D7FE" # blue sky
)

# Add the header
header="yes"

# Where the header place if yes header add on image if no or "" header will be added at out of image
add_on_img="yes"

# Change this value to "" or whatever for disable convert
convert_rounded="yes"

Expand Down Expand Up @@ -176,7 +182,11 @@ function autoRun() {
fi

title "${COLOR_SKY}[+] EDTING IMAGE${COLOR_DEFAULT}"


if [ "${header}" == "yes" ]; then
lampuMerah
fi

if [ "${convert_rounded}" == "yes" ]; then
convertRounded
fi
Expand Down Expand Up @@ -226,6 +236,10 @@ function manualRun() {

title "${COLOR_SKY}[+] EDTING IMAGE${COLOR_DEFAULT}"

if [ "${header}" == "yes" ]; then
lampuMerah
fi

if [ "${convert_rounded}" == "yes" ]; then
convertRounded
fi
Expand Down Expand Up @@ -290,6 +304,65 @@ function convertToPng() {
fi
}

function lampuMerah(){
subtitle "[+]*Set*Header*"

g="#27C93F" #green
y="#FFBD2E" #yellow
r="#FF5F56" #red
b="#282C34" #black

w=$(magick ${file_name} -format "%w" info:)
h=$(magick ${file_name} -format "%h" info:)

if [[ $w > $h ]]; then
h=$w
elif [[ $w < $h ]]; then
w=$h
else
:
fi

rad=$( echo "0.0025 * ${w} * ${h} / 100" | bc )
br=$( echo "${rad} * 5" | bc )
x0=$( echo "${rad} * 3" | bc )
y0=$( echo "${br} * 0.5" | bc )
x1=$( echo "${x0} + ${rad}" | bc )

declare -A arr=()
for i in {0..2}; do
arr[$i,0]=$x0
arr[$i,1]=$y0
arr[$i,2]=$x1
arr[$i,3]=$y0
x0=$( echo "${x0} + ${rad} * 3" | bc )
x1=$( echo "${x0} + ${rad}" | bc)
done

#1520x720
#760x360
if [[ "${add_on_img}" == "yes" ]]; then
magick $file_name -fill $b \
-background $b \
-gravity north \
-chop 0x$br \
-splice 0x$br \
-draw "fill ${r} circle ${arr[0,0]},${arr[0,1]} ${arr[0,2]},${arr[0,3]}
fill ${y} circle ${arr[1,0]},${arr[1,1]} ${arr[1,2]},${arr[1,3]}
fill ${g} circle ${arr[2,0]},${arr[2,1]} ${arr[2,2]},${arr[2,3]}" \
$file_name
else
magick $file_name -fill $b \
-background $b \
-gravity north -splice 0x$br\
-draw "fill ${r} circle ${arr[0,0]},${arr[0,1]} ${arr[0,2]},${arr[0,3]}
fill ${y} circle ${arr[1,0]},${arr[1,1]} ${arr[1,2]},${arr[1,3]}
fill ${g} circle ${arr[2,0]},${arr[2,1]} ${arr[2,2]},${arr[2,3]}" \
$file_name
fi
check
}

function convertRounded() {
subtitle "[+]*Set*Rounded*Corner*"

Expand Down