[anim_dump] アニメーション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
| 固定リンク
property refMe : a reference to current application
###【設定項目】バイナリーへのパス
set strImg2webpPath to ("~/bin/libwebp/bin/img2webp") as text
set strWebpinfoPath to ("~/bin/libwebp/bin/webpinfo") as text
###【設定項目】コマ間隔 1000=1秒
# (8コマ=125 10コマ=100 16コマ≒62 32コマ≒31)
set numDuration to 125 as number
###img2webpパス
set ocidBinPathStr to refMe's NSString's stringWithString:(strImg2webpPath)
set ocidBinPath to ocidBinPathStr's stringByStandardizingPath()
set strImg2webpPath to ocidBinPath as string
###webpinfoパス
set ocidBinPathStr to refMe's NSString's stringWithString:(strWebpinfoPath)
set ocidBinPath to ocidBinPathStr's stringByStandardizingPath()
set strWebpinfoPath 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 listAliasFilePath to (choose file with prompt "ファイルを選んでください" default location aliasDesktopFolder of type {"public.png"} with invisibles and multiple selections allowed without showing package contents) as list
###並び替え用のアレーの初期化
set ocidFilePathArrayM to refMe's NSMutableArray's alloc()'s initWithCapacity:0
###選択したファイルパスをUNIXファイルパスに変換してリストに格納
repeat with itemAliasFilePath in listAliasFilePath
set aliasFilePath to itemAliasFilePath as alias
set strFilePath to (POSIX path of aliasFilePath) as text
(ocidFilePathArrayM's addObject:(strFilePath))
end repeat
####ファイルパスを名前順に並び替え
set ocidSortedArray to ocidFilePathArrayM's sortedArrayUsingSelector:("localizedStandardCompare:")
set numCntImage to (count of ocidSortedArray) as integer
###
#######
###ディレクトリ
set appFileManager to refMe's NSFileManager's defaultManager()
set ocidTempDirURL to appFileManager's temporaryDirectory()
set ocidUUID to refMe's NSUUID's alloc()'s init()
set ocidUUIDString to ocidUUID's UUIDString
set ocidSaveDirPathURL to ocidTempDirURL's URLByAppendingPathComponent:(ocidUUIDString) isDirectory:true
###
set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
# 777-->511 755-->493 700-->448 766-->502
ocidAttrDict's setValue:(448) forKey:(refMe's NSFilePosixPermissions)
set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error|:(reference)
##
set strTempPath to ocidSaveDirPathURL's |path| as text
set strSaveFilePath to (strTempPath & "/animetion.webp") as text
############################
####コマンド行の初期化
############################
set strCommandText to ("") as text
repeat with itemSortedArray in ocidSortedArray
set strFilePath to itemSortedArray as text
###コマンド行【入力ファイル部分】を整形して
set strAddCommandText to ("-lossless -d " & numDuration & " -q 100 \"" & strFilePath & "\"") as text
set strCommandText to (strCommandText & " " & strAddCommandText) as text
end repeat
############################
###コマンド行 出力部
############################
set strCommandText to ("\"" & strImg2webpPath & "\" " & strCommandText & " -o \"" & strSaveFilePath & "\"") as text
do shell script strCommandText
############################
###コマンドWebpinfo部
############################
set strCommandText to ("\"" & strWebpinfoPath & "\" \"" & strSaveFilePath & "\" | grep \"Canvas size\" | tr -d \"Canvas size\"") as text
set strResponse to (do shell script strCommandText) as text
############################
###コマンド行 Ditto部
############################
set strNewFileName to ("animation_" & numCntImage & "_" & strResponse & ".webp") as text
set strDesktopFolder to (POSIX path of aliasDesktopFolder) as text
set strDittoFilePath to (strDesktopFolder & strNewFileName) as text
set strCommandText to ("/usr/bin/ditto \"" & strSaveFilePath & "\" \"" & strDittoFilePath & "\"") as text
do shell script strCommandText
旧バージョン
| 固定リンク
Accessibility Acrobat Acrobat 2020 Acrobat AddOn Acrobat Annotation Acrobat ARMDC Acrobat AV2 Acrobat BookMark Acrobat Classic Acrobat DC Acrobat Dialog Acrobat Distiller Acrobat Form Acrobat JS Acrobat Manifest Acrobat Menu Acrobat Open Acrobat Plugin Acrobat Preferences Acrobat Preflight Acrobat python Acrobat Reader Acrobat SCA Acrobat SCA Updater Acrobat Sequ Acrobat Sign Acrobat Stamps Acrobat Watermark Acrobat Windows Acrobat Windows Reader Admin Admin Account Admin Apachectl Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Mobileconfig Admin Permission Admin Pkg Admin Power Management Admin Printer Admin SetUp Admin SMB Admin Support Admin System Information Admin Tools Admin Users Admin Volumes Adobe Adobe FDKO Adobe RemoteUpdateManager AppKit Apple AppleScript AppleScript do shell script AppleScript List AppleScript ObjC AppleScript Osax AppleScript PDF AppleScript Pictures AppleScript record AppleScript Script Editor AppleScript Script Menu AppleScript Shortcuts AppleScript Shortcuts Events AppleScript System Events AppleScript System Events Plist AppleScript Video Applications AppStore Archive Attributes Automator BackUp Barcode Barcode QR Barcode QR Decode Bash Basic Basic Path Bluetooth BOX Browser Calendar CD/DVD Choose Chrome CIImage CityCode CloudStorage Color com.apple.LaunchServices.OpenWith Console Contacts CotEditor CURL current application Date&Time delimiters Desktop Device Diff Disk Dock DropBox Droplet eMail Encode % Encode Decode Encode UTF8 Error EXIFData ffmpeg File File Name Finder Firefox Folder FolderAction Fonts GIF github Guide HTML HTML Entity Icon Illustrator Image Events Image2PDF ImageOptim iPhone iWork Javascript Jedit Json Label Leading Zero List locationd LRC lsappinfo LSSharedFileList m3u8 Mail MakePDF Map Math Media Media AVAsset Media AVconvert Media AVFoundation Media AVURLAsset Media Movie Media Music Memo Messages Microsoft Microsoft Edge Microsoft Excel Microsoft Fonts Microsoft Office Mouse Music NetWork Notes NSArray NSArray Sort NSBezierPath NSBitmapImageRep NSBundle NSCFBoolean NSCharacterSet NSColor NSColorList NSData NSDecimalNumber NSDictionary NSError NSEvent NSFileAttributes NSFileManager NSFileManager enumeratorAtURL NSFont NSFontManager NSGraphicsContext NSImage NSIndex NSKeyedArchiver NSKeyedUnarchiver NSLocale NSMutableArray NSMutableDictionary NSMutableString NSNotFound NSNumber NSOpenPanel NSPasteboard NSpoint NSPredicate NSPrintOperation NSRange NSRect NSRegularExpression NSRunningApplication NSScreen NSSize NSString NSString stringByApplyingTransform NSStringCompareOptions NSTask NSTimeZone NSURL NSURL File NSURLBookmark NSURLComponents NSURLResourceKey NSURLSession NSUserDefaults NSUUID NSView NSWorkspace Numbers OAuth OneDrive PDF PDFAnnotation PDFAnnotationWidget PDFContext PDFDisplayBox PDFDocumentPermissions PDFImageRep PDFKit PDFnUP PDFOutline perl Photoshop PlistBuddy pluginkit postalcode PostScript prefPane Preview Python QuickLook QuickTime ReadMe Regular Expression Reminders ReName Repeat RTF Safari SaveFile ScreenCapture ScreenSaver SF Symbols character id SF Symbols Entity sips Skype Slack Sound Spotlight sqlite SRT StandardAdditions Swift System Settings TCC TemporaryItems Terminal Text Text CSV Text MD Text TSV TextEdit Tools Translate Trash Twitter Typography UI Unit Conversion UTType valueForKeyPath Video VisionKit Visual Studio Code VMware Fusion Wacom webarchive webp Wifi Windows XML XML EPUB XML OPML XML Plist XML RSS XML savedSearch XML SVG XML TTML XML webloc XML XMP YouTube zoom