[gif2webp]GIFアニメをwebpに変換する
property refMe : a reference to current application
###設定項目
set strBinPath to ("~/bin/libwebp/bin/gif2webp") as text
##バイナリのパス
set strBinPathStr to refMe's NSString's stringWithString:(strBinPath)
set ocidFilePath to strBinPathStr's stringByStandardizingPath()
set strBinPath to ocidFilePath as string
##デフォルトロケーション
tell application "Finder"
set aliasDefaultLocation to container of (path to me) as alias
set aliasDesktopFolder to (path to desktop folder from user domain) as alias
end tell
###ダイアログを前面に
tell current application
set strName to name as text
end tell
####スクリプトメニューから実行したら
if strName is "osascript" then
tell application "Finder" to activate
else
tell current application to activate
end if
##ダイアログ
set listAliasFilePath to (choose file with prompt "GIFファイルを選んでください" default location aliasDefaultLocation of type {"com.compuserve.gif"} with invisibles and multiple selections allowed without showing package contents) as list
##選んだファイルの数だけ実行
repeat with itemAliasFilePath in listAliasFilePath
tell application "Finder"
set aliasFilePath to itemAliasFilePath as alias
###ファイルパスを取得
set strFilePath to (POSIX path of aliasFilePath) as text
end tell
###コマンド整形
set strCommandText to ("\"" & strBinPath & "\" \"" & strFilePath & "\" -q 100 -o \"" & strFilePath & ".webp\"") as text
####実行
tell application "Terminal"
launch
activate
set objWindowID to (do script "\n\n")
delay 2
do script strCommandText in objWindowID
end tell
####処理が終わるのをまってから次にかかる
repeat
tell application "Terminal"
tell front window
set boolTabStatus to busy
end tell
end tell
if boolTabStatus is false then
exit repeat
--->このリピートを抜けて次の処理へ
else if boolTabStatus is true then
delay 3
--->busyなのであと3秒まつ
end if
end repeat
end repeat
| 固定リンク
「webp」カテゴリの記事
- [ffmpeg]ムービーファイルをアニメーションwebpにする(2023.12.06)
- [anim_dump] アニメーションWEBPファイルから各フレームイメージを書き出す(フレームイメージ)(2024.01.08)
- [webpmux] アニメーションWEBPファイルから各フレームイメージを書き出す(2023.12.20)
- [applescript]libwebpインストール(2024.01.07)
- [bash]libwebpインストール(2024.01.08)
「GIF」カテゴリの記事
- [Combined Merged PNG]マルチレイヤ構造のPNG画像をGIFアニメに変換する(簡易版)(2024.01.31)
- [Combined Merged PNG]マルチレイヤ構造のPNG画像を個別のファイルにする(2024.01.31)
- [com.sindresorhus.Gifski]GifSkiのテンポラリディレクトリを開く(Gifファイルの保存先)(2024.01.11)
- [bash]gifskiインストール(2024.01.08)
- アニメーション画像(2024.01.31)