1
0
This commit is contained in:
2023-04-01 04:52:34 +09:00
parent ad8daeb7d1
commit 48dbada67f
77 changed files with 2253 additions and 197 deletions

16
scpt/card_number_push.zsh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/zsh
d=${0:a:h}
dd=${0:a:h:h}
url=https://syui.ai/img
json=$dd/public/json/card.json
n=`cat $json|jq "length"`
n=`expr $n - 1`
for ((i=0;i<=14;i++))
do
sid=`cat $json|jq -r ".[$i].src"`
id=`cat $json|jq -r ".[$i].id"`
curl -sL $url/${sid}.png -o ~/ai/yui/content/img/${id}.png
done

62
scpt/convert.zsh Executable file
View File

@ -0,0 +1,62 @@
#!/bin/zsh
d=${0:a:h}
dd=${0:a:h:h}
url=syui.ai/img
case $OSTYPE in
darwin*)
path_nvm_sh="/opt/homebrew/opt/nvm/nvm.sh";;
linux*)
path_nvm_sh="";;
esac
dir=$dd/public/card
static=$dd/static/img
json=$dd/public/json/card.json
mkdir -p $dir
mkdir -p $static
n=`cat $json|jq "length"`
n=`expr $n - 1`
bg=$static/card_bg.png
br=$static/card_br.png
cd $dir
export NVM_DIR="$HOME/.nvm"
[ -s "$path_nvm_sh" ] && \. "$path_nvm_sh"
nvm use 17
nvm i squoosh-cli
for ((i=0;i<=$n;i++))
do
p=`cat $json|jq -r ".[$i].p"`
sid=`cat $json|jq -r ".[$i].src"`
s=$static/${sid}.png
id=`cat $json|jq -r ".[$i].id"`
o=$dir/card_$id.png
gif=$dir/card_$id.gif
if [ -f $o ];then
continue
fi
if [ ! -f $s ];then
curl -sL $url/yui_${sid}.png -o $s
fi
if [ ! -f $o ] && [ -n "`echo $s|grep ai_model`" ];then
model_card=$dir/${sid}.png
model_webp=$dir/${sid}.webp
cp -rf $model_card $o
squoosh-cli --webp '{"quality":100}' -d ./ --resize '{width:825,height:1080}' $o
fi
if [ ! -f $o ];then
#if [ ! -f $o ] && [ -z "`echo $s|grep ai_model`" ];then
composite -gravity north -geometry +0+160 -compose over $s $bg $o.back
composite -gravity north -geometry +0+0 -compose over $br $o.back $o
squoosh-cli --webp '{"quality":100}' -d ./ --resize '{width:825,height:1080}' $o
rm $o.back
fi
done

53
scpt/convert_origin.zsh Executable file
View File

@ -0,0 +1,53 @@
#!/bin/zsh
d=${0:a:h}
dd=${0:a:h:h}
url=syui.ai/img
case $OSTYPE in
darwin*)
path_nvm_sh="/opt/homebrew/opt/nvm/nvm.sh";;
linux*)
path_nvm_sh="";;
esac
dir=$dd/public/card
static=$dd/static/img
json=$dd/public/json/card.json
mkdir -p $dir
mkdir -p $static
n=`cat $json|jq "length"`
n=`expr $n - 1`
bg=$static/card_bg_origin.png
br=$static/card_br.png
cd $dir
export NVM_DIR="$HOME/.nvm"
[ -s "$path_nvm_sh" ] && \. "$path_nvm_sh"
nvm use 17
nvm i squoosh-cli
for ((i=0;i<=$n;i++))
do
p=`cat $json|jq -r ".[$i].p"`
sid=`cat $json|jq -r ".[$i].src"`
s=$static/${sid}.png
id=`cat $json|jq -r ".[$i].id"`
o=$dir/card_origin_${id}.png
if [ -f $o ];then
continue
fi
if [ ! -f $s ];then
curl -sL $url/yui_${sid}.png -o $s
fi
if [ ! -f $o ] && [ -z "`echo $s|grep ai_model`" ];then
composite -gravity north -geometry +0+160 -compose over $s $bg $o.back
composite -gravity north -geometry +0+0 -compose over $br $o.back $o
squoosh-cli --webp '{"quality":100}' -d ./ --resize '{width:825,height:1080}' $o
rm $o.back
fi
done

53
scpt/convert_origin2.zsh Executable file
View File

@ -0,0 +1,53 @@
#!/bin/zsh
d=${0:a:h}
dd=${0:a:h:h}
url=syui.ai/img
case $OSTYPE in
darwin*)
path_nvm_sh="/opt/homebrew/opt/nvm/nvm.sh";;
linux*)
path_nvm_sh="";;
esac
dir=$dd/public/card
static=$dd/static/img
json=$dd/public/json/card.json
mkdir -p $dir
mkdir -p $static
n=`cat $json|jq "length"`
n=`expr $n - 1`
bg=$static/card_bg_origin2.png
br=$static/card_br.png
cd $dir
export NVM_DIR="$HOME/.nvm"
[ -s "$path_nvm_sh" ] && \. "$path_nvm_sh"
nvm use 17
nvm i squoosh-cli
for ((i=0;i<=$n;i++))
do
p=`cat $json|jq -r ".[$i].p"`
sid=`cat $json|jq -r ".[$i].src"`
s=$static/${sid}.png
id=`cat $json|jq -r ".[$i].id"`
o=$dir/card_origin2_${id}.png
if [ -f $o ];then
continue
fi
if [ ! -f $s ];then
curl -sL $url/yui_${sid}.png -o $s
fi
if [ ! -f $o ] && [ -z "`echo $s|grep ai_model`" ];then
composite -gravity north -geometry +0+160 -compose over $s $bg $o.back
composite -gravity north -geometry +0+0 -compose over $br $o.back $o
squoosh-cli --webp '{"quality":100}' -d ./ --resize '{width:825,height:1080}' $o
rm $o.back
fi
done

55
scpt/convert_s.zsh Executable file
View File

@ -0,0 +1,55 @@
#!/bin/zsh
d=${0:a:h}
dd=${0:a:h:h}
url=syui.ai/img
case $OSTYPE in
darwin*)
path_nvm_sh="/opt/homebrew/opt/nvm/nvm.sh";;
linux*)
path_nvm_sh="";;
esac
dir=$dd/public/card
static=$dd/static/img
json=$dd/public/json/card.json
mkdir -p $dir
mkdir -p $static
n=`cat $json|jq "length"`
n=`expr $n - 1`
bg=$static/card_bg_s.png
br=$static/card_bg_sr.png
for ((i=0;i<=$n;i++))
do
p=`cat $json|jq -r ".[$i].p"`
sid=`cat $json|jq -r ".[$i].src"`
s=$static/${sid}.png
id=`cat $json|jq -r ".[$i].id"`
o=$dir/test_${id}s.png
if [ -f $o ];then
continue
fi
if [ ! -f $s ];then
curl -sL $url/yui_${sid}.png -o $s
fi
#if [ ! -f $o ];then
composite -gravity north -geometry +0+160 -compose over $s $bg $o.back
composite -gravity north -geometry +0+0 -compose over $br $o.back $o
rm $o.back
#fi
done
cd $dir
export NVM_DIR="$HOME/.nvm"
[ -s "$path_nvm_sh" ] && \. "$path_nvm_sh"
nvm use 17
nvm i squoosh-cli
#rm og_*
squoosh-cli --webp '{"quality":100}' -d ./ --resize '{width:825,height:1080}' *.png
#mogrify -resize 1620x2160! *.png

59
scpt/gif.zsh Executable file
View File

@ -0,0 +1,59 @@
#!/bin/zsh
d=${0:a:h}
dd=${0:a:h:h}
url=syui.ai/img
case $OSTYPE in
darwin*)
path_nvm_sh="/opt/homebrew/opt/nvm/nvm.sh";;
linux*)
path_nvm_sh="";;
esac
dir=$dd/public/card
static=$dd/static/img
json=$dd/public/json/card.json
mkdir -p $dir
mkdir -p $static
n=`cat $json|jq "length"`
n=`expr $n - 1`
bg=$static/card_bg.png
br=$static/card_br.png
for ((i=0;i<=$n;i++))
do
p=`cat $json|jq -r ".[$i].p"`
sid=`cat $json|jq -r ".[$i].src"`
s=$static/${sid}.png
id=`cat $json|jq -r ".[$i].id"`
gif=$dir/card_$id.gif
if [ -f $gif ];then
continue
fi
nn=`ls $static/card_bgg_*.png|wc -l`
nn=$((nn - 1))
for ((ii=0;ii<=$nn;ii++))
do
title=$dir/null
o=${title}_${ii}.png
br=$static/card_bgg_${ii}.png
composite -gravity north -geometry +0+160 -compose over $s $bg $o.back
composite -gravity north -geometry +0+0 -compose over $br $o.back $o
rm $o.back
export NVM_DIR="$HOME/.nvm"
[ -s "$path_nvm_sh" ] && \. "$path_nvm_sh"
nvm use 17
nvm i squoosh-cli
squoosh-cli --webp '{"quality":100}' -d $dir --resize '{width:400,height:524}' $o
done
convert -layers optimize -loop 0 -delay 40 $dir/null_*.webp $gif
rm -f $dir/null_*
done

59
scpt/gif_first.zsh Executable file
View File

@ -0,0 +1,59 @@
#!/bin/zsh
d=${0:a:h}
dd=${0:a:h:h}
url=syui.ai/img
case $OSTYPE in
darwin*)
path_nvm_sh="/opt/homebrew/opt/nvm/nvm.sh";;
linux*)
path_nvm_sh="";;
esac
dir=$dd/public/card
static=$dd/static/img
json=$dd/public/json/card.json
mkdir -p $dir
mkdir -p $static
n=`cat $json|jq "length"`
n=`expr $n - 1`
bg=$static/card_bg.png
br=$static/card_br.png
for ((i=0;i<=$n;i++))
do
p=`cat $json|jq -r ".[$i].p"`
sid=`cat $json|jq -r ".[$i].src"`
s=$static/${sid}.png
id=`cat $json|jq -r ".[$i].id"`
gif=$dir/card_first_$id.gif
if [ -f $gif ];then
continue
fi
nn=`ls $static/card_bgg_first_*.png|wc -l`
nn=$((nn - 1))
for ((ii=0;ii<=$nn;ii++))
do
title=$dir/null
o=${title}_first_${ii}.png
br=$static/card_bgg_first_${ii}.png
composite -gravity north -geometry +0+160 -compose over $s $bg $o.back
composite -gravity north -geometry +0+0 -compose over $br $o.back $o
rm $o.back
export NVM_DIR="$HOME/.nvm"
[ -s "$path_nvm_sh" ] && \. "$path_nvm_sh"
nvm use 17
nvm i squoosh-cli
squoosh-cli --webp '{"quality":100}' -d $dir --resize '{width:400,height:524}' $o
done
convert -layers optimize -loop 0 -delay 40 $dir/null_*.webp $gif
rm -f $dir/null_*
done

38
scpt/model_gif.zsh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/zsh
inp=mp4
for i in *.${inp}
do
ffmpeg -i *.${inp} -r 8 %04d.png
done
inp=png
out=jpg
for i in *.${inp}
do
convert ${i%.*}.${inp} -gravity center -crop 825x1080+0+0 ${i%.*}_crop.${inp}
convert ${i%.*}_crop.${inp} -resize 1620x2160! ${i%.*}.${out}
done
nn=`ls *.jpg|wc -l`
static=~/ai/card/static/img
bg=$static/card_bg.png
br=$static/card_br.png
for ((ii=1;ii<=$nn;ii++))
do
s=`ls *.jpg|awk "NR==$ii"`
o=null_${ii}.png
echo $o
if [ -f $b ];then
echo yes
else
echo no
fi
composite -gravity north -geometry +0+160 -compose over $s $bg $o.back
composite -gravity north -geometry +0+0 -compose over $br $o.back $o
rm $o.back
done
gif=`ls *.mp4|cut -d . -f 1`.gif
convert -layers optimize -loop 0 -delay 40 null_*.png $gif
rm *.jpg
rm *.png

56
scpt/ogimage.zsh Executable file
View File

@ -0,0 +1,56 @@
#!/bin/zsh
url=https://card.syui.ai
d=${0:a:h}
dd=${0:a:h:h}
dir=$dd/public/card
o_dir=$dd/static/img
static=$dd/static/img
json=$dd/public/json/card.json
mkdir -p $dir
mkdir -p $static
n=`cat $json|jq "length"`
n=`expr $n - 1`
for ((i=0;i<=$n;i++))
do
p=`cat $json|jq -r ".[$i].p"`
h=`cat $json|jq -r ".[$i].h"`
sid=`cat $json|jq -r ".[$i].src"`
s=$static/${sid}.png
id=`cat $json|jq -r ".[$i].id"`
o=$dir/card_$id.png
oo=$o_dir/og_${id}.png
o_url=$url/card/og_${id}.png
index=$o_dir/$id/index.html
if [ ! -f $oo ];then
convert $o -gravity center -extent 8000x4000 $oo
fi
# mkdir -p $o_dir/$id
#
#echo '
#<!DOCTYPE html>
#<html lang="en">
#<head>
#<title>card.syui.ai</title><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>card.syui.ai</title><link href="app.css" rel="preload" as="style"><link href="app.js" rel="preload" as="script"><link href="chunk-vendors.js" rel="preload" as="script"><link href="app.css" rel="stylesheet">
#<meta name="twitter:card" content="summary">
#<meta property="og:url" content="https://card.syui.ai">
#' >! $index
#
#echo "
#<meta property=\"og:title\" content=\"$h\">
#<meta property=\"og:description\" content=\"$p\">
#<meta property=\"og:image\" content=\"$o_url\">
#" >> $index
#
#echo '
#</head>
#<body>
#<div id="app"></div><script src="chunk-vendors.js"></script><script src="app.js"></script>
#</body>
#</html>
#' >> $index
done