stickerpack_assembler/make.jq

19 lines
1018 B
Plaintext
Raw Normal View History

2023-09-29 13:03:18 +00:00
#!/usr/bin/env jq
. as $stickers | [
"allstickers_"+$out_ext+": " + ( [ $stickers[]| select(.disabled != "true") | "../stickers/sticker_"+.name+"."+$out_ext ] | join(" ")),
($stickers[] | select(.disabled != "true") | [
"../stickers/sticker_"+.name+"."+$out_ext + ": "+ ((.in[]| select(.format != "lavfi") | .input )|gsub("(\\s+)"; "\\ ")),
"ffmpeg "
+(if .in.base.format then "-f "+.in.base.format else "" end) +" -i "+ (.in.base.input|@sh)
+ " -vf "
+(if .colors and .colors.transparent then "geq=\\''"
+"r=if(lt(alpha(X,Y),128),"+(.colors.transparent[0]|tostring)+",r(X,Y)):"
+"g=if(lt(alpha(X,Y),128),"+(.colors.transparent[1]|tostring)+",g(X,Y)):"
+"b=if(lt(alpha(X,Y),128),"+(.colors.transparent[2]|tostring)+",b(X,Y)):"
+"a=alpha(X,Y)'\\'," else "" end)
+"scale=w=512:h=512:force_original_aspect_ratio=decrease"
+ " "
+"-y -lossless 1 "+$out_format+" ../stickers/sticker_"+.name+"."+$out_ext
] | join("\n\t"))
] | join ("\n")