[anim_dump] アニメーションWEBPファイルから各フレームイメージを書き出す(フレームイメージ)
#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
(* libwebpが別途必要です
[applescript]libwebpインストール
https://quicktimer.cocolog-nifty.com/icefloe/2024/01/post-0a1a86.html
WEBPのアニメーションファイルからのイメージシーケンスの書き出しは
GIFと違って各フレームには
差分のみ保存されていますので あまり使いやすいものでもありません
*)
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "AppKit"
use scripting additions
property refMe : a reference to current application
###【設定項目】バイナリーへのパス
set strAnim_dumpPath to ("~/bin/libwebp/bin/anim_dump") as text
###anim_dumpパス
set ocidBinPathStr to refMe's NSString's stringWithString:(strAnim_dumpPath)
set ocidBinPath to ocidBinPathStr's stringByStandardizingPath()
set strAnim_dumpPath to ocidBinPath as string
###ダイアログを前面に
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
tell application "Finder"
set aliasDesktopFolder to (path to desktop folder from user domain) as alias
end tell
####ファイル選択ダイアログ
set aliasFilePath to (choose file with prompt "WEBPのアニメーションファイルを選んでください" default location aliasDesktopFolder of type {"org.webmproject.webp"} with invisibles without showing package contents and multiple selections allowed) as alias
###入力ファイル
set strFilePath to (POSIX path of aliasFilePath) as text
##出力用のディレクトリを作る
tell application "Finder"
set strInputFileName to (name of aliasFilePath) as text
set strSaveDirName to (strInputFileName & "_フレーム画像") as text
set aliasContainerDirPath to (container of aliasFilePath) as alias
make new folder at aliasContainerDirPath with properties {name:strSaveDirName}
set aliasSaveDirPath to (folder strSaveDirName of folder aliasContainerDirPath) as alias
end tell
##出力用のディレクトリのパス
set strSaveDirPath to (POSIX path of aliasSaveDirPath) as text
############################
####anim_dump
############################
set strCommandText to ("\"" & strAnim_dumpPath & "\" -folder \"" & strSaveDirPath & "\" -prefix \"Flame_\" \"" & strFilePath & "\"") as text
set strResponse to (do shell script strCommandText) as text
| 固定リンク
「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)