Skip to content

Instantly share code, notes, and snippets.

View novogrammer's full-sized avatar

Yusuke Kawamoto novogrammer

View GitHub Profile
@novogrammer
novogrammer / image_dimension.sh
Created June 7, 2025 01:52
画像の解像度を調べてCSSのwidthとheightを表示する
#!/bin/bash
scale=1 # デフォルト値
while getopts "s:" opt; do
case "$opt" in
s) scale="$OPTARG" ;;
esac
done
@novogrammer
novogrammer / make_favicon.sh
Last active December 13, 2024 03:25
imagemagickでfavicon.icoを作成する
#!/bin/bash
# SVGからの変換はPhotoshopでやったほうがいい
# convert favicon.svg -resize 32x32 favicon.png
convert favicon.png -define icon:auto-resize=16,32 favicon.ico
@novogrammer
novogrammer / zip_for_win.sh
Created December 8, 2024 15:23
windows用のzipファイルを作る
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "Usage: $0 <target-directory-or-file>"
exit 1
fi
TARGET="$1"
# 7zzコマンドを使用してWindows互換性の高いzipを作成
@novogrammer
novogrammer / png2gif.sh
Created October 25, 2023 11:46
transparent PNG to transparent GIF
#!/bin/bash
# 50fps
convert -delay 2 -loop 0 -layers OptimizeFrame input*.png output.gif
@novogrammer
novogrammer / png2webm.sh
Last active October 24, 2023 16:42
transparent PNG to transparent WEBM
#!/bin/bash
# 60fps
ffmpeg -r 60 -i input%03d.png -crf 10 -b:v 1M output.webm
@novogrammer
novogrammer / png2mov.sh
Last active October 24, 2023 10:51
transparent PNG to transparent MOV
#!/bin/bash
# 60fps
ffmpeg -r 60 -i input%03d.png -c:v hevc_videotoolbox -colorspace bt2020nc -color_trc bt709 -color_primaries bt2020 -vf setparams=color_primaries=bt2020:color_trc=bt709:colorspace=bt2020nc -alpha_quality 0.9 -vtag hvc1 -b:v 1M output.mov
# without colorspace
#ffmpeg -r 60 -i input%03d.png -c:v hevc_videotoolbox -alpha_quality 0.9 -vtag hvc1 -crf 10 -b:v 1M output.mov
# too large
#ffmpeg -r 60 -i input%02d.png -c:v prores_ks output.mov
@novogrammer
novogrammer / mov2webm.sh
Last active October 21, 2023 11:28
transparent MOV to transparent WEBM
#!/bin/bash
ffmpeg -i input.mov -crf 10 -b:v 1M output.webm
@novogrammer
novogrammer / download100images.mjs
Created February 17, 2023 11:19
download100images.mjs
import {execSync} from "child_process"
function zeroPadding(num, qty) {
return `${"0".repeat(qty)}${num}`.slice(qty * -1);
}
async function main(){
for(let i=0;i<100;i+=1){
const text=`image${zeroPadding(i,2)}`;
const filename=`${text}.jpg`;
@novogrammer
novogrammer / LottieSprite.ts
Last active February 3, 2023 07:46
LottieSprite.ts
import {IDestroyOptions,Sprite,Texture} from "pixi.js"
import lottie, { AnimationConfigWithPath, AnimationDirection, AnimationItem, AnimationSegment } from "lottie-web";
interface LottieSpriteParams{
path?:string;
animationData?:Object;
loop?:boolean;
autoplay?:boolean;
onConfigReady?:()=>void,
}
@novogrammer
novogrammer / memory.html
Created May 9, 2022 12:03
WebAssembly.Memory test
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<style>
.run{
}
th,td{
border:1px solid #000;