AppleScript名:アニメーションGIFをフレームごとにTIFF画像に分解する |
— Created 2016-11-29 by Takaaki Naganoya — 2016 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AppKit" set gifFile to POSIX path of (choose file of type "com.compuserve.gif" with prompt "Select Animation-GIF file") set destFol to POSIX path of (choose folder with prompt "Select the folder to save gif’s frames") set anImage to current application’s NSImage’s alloc()’s initWithContentsOfFile:gifFile if anImage is equal to missing value then error "Illegal GIF Image" set anImgRep to anImage’s representations()’s firstObject() set framesNum to (anImgRep’s valueForProperty:"NSImageFrameCount") as integer repeat with i from 0 to (framesNum – 1) (anImgRep’s setProperty:"NSImageCurrentFrame" withValue:i) set aRep to (anImgRep’s representationUsingType:(current application’s NSTIFFFileType) |properties|:(missing value)) (aRep’s writeToFile:(destFol & (i as string) & ".tif") atomically:true) end repeat |
AppleScript名:アニメーションGIFをフレームごとにPNG画像に分解する |
— Created 2016-11-29 by Takaaki Naganoya — 2016 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AppKit" set gifFile to POSIX path of (choose file of type "com.compuserve.gif" with prompt "Select Animation-GIF file") set destFol to POSIX path of (choose folder with prompt "Select the folder to save gif’s frames") set anImage to current application’s NSImage’s alloc()’s initWithContentsOfFile:gifFile if anImage is equal to missing value then error "Illegal GIF Image" set anImgRep to anImage’s representations()’s firstObject() set framesNum to (anImgRep’s valueForProperty:"NSImageFrameCount") as integer repeat with i from 0 to (framesNum – 1) (anImgRep’s setProperty:"NSImageCurrentFrame" withValue:i) set aRep to (anImgRep’s representationUsingType:(current application’s NSPNGFileType) |properties|:(missing value)) (aRep’s writeToFile:(destFol & (i as string) & ".png") atomically:true) end repeat |
AppleScript名:アニメーションGIFをフレームごとにJPG画像に分解する |
— Created 2016-11-29 by Takaaki Naganoya — 2016 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AppKit" set gifFile to POSIX path of (choose file of type "com.compuserve.gif" with prompt "Select Animation-GIF file") set destFol to POSIX path of (choose folder with prompt "Select the folder to save gif’s frames") set anImage to current application’s NSImage’s alloc()’s initWithContentsOfFile:gifFile if anImage is equal to missing value then error "Illegal GIF Image" set anImgRep to anImage’s representations()’s firstObject() set framesNum to (anImgRep’s valueForProperty:"NSImageFrameCount") as integer repeat with i from 0 to (framesNum – 1) (anImgRep’s setProperty:"NSImageCurrentFrame" withValue:i) set aRep to (anImgRep’s representationUsingType:(current application’s NSJPEGFileType) |properties|:(missing value)) (aRep’s writeToFile:(destFol & (i as string) & ".jpg") atomically:true) end repeat |
AppleScript名:アニメーションGIFをフレームごとにGIFF画像に分解する |
— Created 2016-11-29 by Takaaki Naganoya — 2016 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AppKit" set gifFile to POSIX path of (choose file of type "com.compuserve.gif" with prompt "Select Animation-GIF file") set destFol to POSIX path of (choose folder with prompt "Select the folder to save gif’s frames") set anImage to current application’s NSImage’s alloc()’s initWithContentsOfFile:gifFile if anImage is equal to missing value then error "Illegal GIF Image" set anImgRep to anImage’s representations()’s firstObject() set framesNum to (anImgRep’s valueForProperty:"NSImageFrameCount") as integer repeat with i from 0 to (framesNum – 1) (anImgRep’s setProperty:"NSImageCurrentFrame" withValue:i) set aRep to (anImgRep’s representationUsingType:(current application’s NSGIFFileType) |properties|:(missing value)) (aRep’s writeToFile:(destFol & (i as string) & ".gif") atomically:true) end repeat |
More from my site
(Visited 98 times, 1 visits today)
2018年に書いた価値あるScript – AppleScriptの穴 says:
[…] ・アニメーションGIFをフレームごとに画像に分解する 分解すること自体にはあまり意味はありませんが、アニメーションGIFを作成するObjective-Cのプログラムが見つからない今日このごろ […]