AppleScript Image Events

カラーモード判定


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use framework "UniformTypeIdentifiers"
use framework "AppKit"
use scripting additions
property refMe : a reference to current application
set appFileManager to refMe's NSFileManager's defaultManager()


set appFileManager to refMe's NSFileManager's defaultManager()
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
set aliasDefaultLocation to (ocidDesktopDirPathURL's absoluteURL()) as alias
###ダイアログ
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 listUTI to {"public.image"}
set strMes to ("ファイルを選んでください") as text
set strPrompt to ("ファイルを選んでください") as text
try
  ### ファイル選択時
  set listAliasFilePath to (choose file strMes with prompt strPrompt default location (aliasDefaultLocation) of type listUTI with invisibles, showing package contents and multiple selections allowed) as list
on error
log "エラーしました"
return "エラーしました"
end try

set numCntFile to (count of listAliasFilePath) as integer
tell application "Image Events" to activate
repeat with itemIntNo from 1 to numCntFile by 1
  tell application "Image Events"
    set objImage to open item numCntFile of listAliasFilePath
    set strColorSpace to (color space of objImage) as text
    if strColorSpace is "RGB" then
log "カラーは" & strColorSpace & "です"
      
    else if strColorSpace is "CMYK" then
log "カラーは" & strColorSpace & "です"
      
    end if
close objImage
  end tell
end repeat



#!/bin/bash
#com.cocolog-nifty.quicktimer.icefloe
#################################################

STR_FILE_PATH="/Library/User Pictures/Fun/Medal.heic"

STR_RESPONSE=$(/usr/bin/sips --getProperty space "$STR_FILE_PATH")
/bin/echo "$STR_RESPONSE"

if [[ "$STR_RESPONSE" == *CMYK* ]]; then
/bin/echo "CMYK画像です"

elif [[ "$STR_RESPONSE" == *RGB* ]]; then
/bin/echo "RGB画像です"

fi

exit 0


【スクリプトエディタで開く】|

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions
property refMe : a reference to current application
set appFileManager to refMe's NSFileManager's defaultManager()


set appFileManager to refMe's NSFileManager's defaultManager()
set ocidURLsArray to (appFileManager's URLsForDirectory:(refMe's NSDesktopDirectory) inDomains:(refMe's NSUserDomainMask))
set ocidDesktopDirPathURL to ocidURLsArray's firstObject()
set aliasDefaultLocation to (ocidDesktopDirPathURL's absoluteURL()) as alias
###ダイアログ
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 listUTI to {"public.image"}
set strMes to ("ファイルを選んでください") as text
set strPrompt to ("ファイルを選んでください") as text
try
  ### ファイル選択時
  set listAliasFilePath to (choose file strMes with prompt strPrompt default location (aliasDefaultLocation) of type listUTI with invisibles, showing package contents and multiple selections allowed) as list
on error
log "エラーしました"
return "エラーしました"
end try

repeat with itemAliasFilePath in listAliasFilePath
  set aliasFilePath to itemAliasFilePath as alias
  set strFilePath to (POSIX path of aliasFilePath) as text
  set strCommandText to ("/usr/bin/sips --getProperty space \"" & strFilePath & "\"")
  set strResponse to (do shell script strCommandText) as text
  if strResponse contains "RGB" then
log "カラーはRGBです"
    
  else if strResponse contains "CMYK" then
log "カラーはCMYKです"
    
  end if
end repeat


|

[NSBitmapImageRep]画像の解像度変更(resolution)

pngファイル144ppi -->スクリーンキャプチャーの解像度

pngファイル72ppiに変更します
解像度の変更のみですので、画像のpixelサイズは元画像のままです


#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

######ログ表示
doLogView()

property refMe : a reference to current application
property refNSString : a reference to refMe's NSString
property refNSMutableString : a reference to refMe's NSMutableString
property refNSURL : a reference to refMe's NSURL
property refNSImage : a reference to refMe's NSImage



####ダイアログで使うデフォルトロケーション
tell application "Finder"
set aliasDefaultLocation to (path to desktop folder from user domain) as alias
end tell

####UTIリスト PDFのみ
set listUTI to {"public.png"}

####ダイアログを出す
set aliasFilePath to (choose file with prompt "PNGイメージファイルを選んでください" default location (aliasDefaultLocation) of type listUTI with invisibles and showing package contents without multiple selections allowed) as alias

set strFilePath to POSIX path of aliasFilePath


##Make NSString
set ocidNSString to refNSString's stringWithString:strFilePath
log ocidNSString as text
log ocidNSString's className() as text
####NSimageに格納
set ocidImageData to refNSImage's alloc()'s initWithContentsOfFile:strFilePath
log ocidImageData
log className() of ocidImageData as text
###サイズ取得PT
set ocidImageSize to ocidImageData's |size|()
log ocidImageSize
log class of ocidImageSize as text
log "#####"
###representations取得
set ocidImageRepArray to ocidImageData's representations()
log ocidImageRepArray
log className() of ocidImageRepArray as text
###NSBitmapImageRep取得
set ocidImageRep to (ocidImageRepArray's objectAtIndex:0)
log ocidImageRep
log className() of ocidImageRep as text
####ピクセル単位での幅
set numpixelsWidth to ocidImageRep's pixelsWide()
log numpixelsWidth
log class of numpixelsWidth as text
####ピクセル単位での高さ
set numpixelsHeight to ocidImageRep's pixelsHigh()
log numpixelsHeight
log class of numpixelsHeight as text
####ポイント単位でのサイズ
set ocidImageRepSize to ocidImageRep's |size|()
log ocidImageRepSize
log class of ocidImageRepSize as text
####ポイント単位での幅と高さ
set numPointWidth to width of ocidImageRepSize
set numPointHeight to height of ocidImageRepSize
log numPointWidth
log numPointHeight
####イメージの解像度
set numCurrentDPI to ((72 * numpixelsWidth) / numPointWidth) as integer
log numCurrentDPI
####変更後のポイントサイズを求める
set numNewImageWidth to ((72.0 * numpixelsWidth) / 72)
set numNewImageHeight to ((72.0 * numpixelsHeight) / 72)
set recordNewImageSize to {width:numNewImageWidth, height:numNewImageHeight} as record
log recordNewImageSize
####ImageRepをポイントサイズに変更
ocidImageRep's setSize:recordNewImageSize
###確認用
set ocidImageRepSize to ocidImageRep's |size|()
log ocidImageRepSize
log class of ocidImageRepSize as text
###PNGで保存する
set ocidSaveImageType to refMe's NSBitmapImageFileTypePNG
###インターレースとアルファは保持
set ocidNewImageData to ocidImageRep's representationUsingType:ocidSaveImageType |properties|:{NSImageInterlaced:true, NSImageDitherTransparency:true}
###上書き保存
ocidNewImageData's writeToFile:strFilePath atomically:false

set ocidImageRep to ""
set ocidNewImageData to ""

#########################ログ表示
to doLogView()

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
tell application "Script Editor"
tell application "System Events"
tell process "Script Editor"
tell window 1
tell splitter group 1
tell splitter group 1
tell group 1
tell checkbox "返された値"
set boolValue to value as boolean
end tell
if boolValue is false then
click checkbox "返された値"
end if
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end if
end repeat

end doLogView
#########################

|

[NSBitmapImageRep]画像のサイズ変更(CROP)

元画像
左用と右用のファイルに複製
順番に開いて変更後のCROPサイズでNSBitmapImageRepを作成
元画像をNSBitmapImageRepに場所指定してNSCompositeSourceOverする
(小さいサイズに大きいサイズを座標で上から置くのではみ出た部分は削除される)
-->この方法が正しいか?は疑問だがQRコード作った時の使い回し
出来上がったCROP画像データをファイルに『上書き』で『書き出す』



#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
##自分環境がos12なので2.8にしているだけです
use AppleScript version "2.8"
use framework "Foundation"
use scripting additions
use framework "UniformTypeIdentifiers"

property objMe : a reference to current application
property objNSString : a reference to objMe's NSString
property objNSURL : a reference to objMe's NSURL

property objNSArray : a reference to objMe's NSArray
property objNSMutableArray : a reference to objMe's NSMutableArray
property objUTType : a reference to objMe's UTType

property objNSDictionary : a reference to NSDictionary

property objNSImage : a reference to objMe's NSImage
property objNSBitmapImageRep : a reference to objMe's NSBitmapImageRep
property objNSGraphicsContext : a reference to objMe's NSGraphicsContext

set objFileManager to objMe's NSFileManager's defaultManager()
set ocidNSURLIsRegularFileKey to objMe's NSURLIsRegularFileKey

############################################
###設定項目##左右ページ 右から左ならtrue 左から右ならfalse
############################################
set boolRtoL to true as boolean

############################################
######ログ表示
doLogView()

tell application "Finder"
##set aliasDefaultLocation to container of (path to me) as alias
set aliasDefaultLocation to (path to desktop folder from user domain) as alias
end tell

try
set aliasResponse to (choose folder "画像が入っているフォルダを選んでください" with prompt "フォルダを選択してください" default location aliasDefaultLocation without multiple selections allowed, invisibles and showing package contents)
on error
log "エラーしました"
return
end try


###パス
set strDirPath to POSIX path of aliasResponse as text
###NSStringテキスト
set ocidDirPath to (objNSString's stringWithString:strDirPath)
#####NSURL NSStringURL
set ocidDirUrlPath to (objNSURL's fileURLWithPath:ocidDirPath)
###不可視ファイル以外のファイルを取得
set ocidContentsArray to objFileManager's contentsOfDirectoryAtURL:ocidDirUrlPath includingPropertiesForKeys:{ocidNSURLIsRegularFileKey} options:(objMe's NSDirectoryEnumerationSkipsHiddenFiles) |error|:(missing value)
####可変リストに変更
set ocidSortedArrayM to objNSMutableArray's arrayWithArray:ocidContentsArray
#####UNIXパス形式
set ocidSortedArrayM to ocidSortedArrayM's valueForKeyPath:"path"
###ローカライズ順でソート
set ocidSortedArrayM to (ocidSortedArrayM's sortedArrayUsingSelector:"localizedCompare:")
###出来上がりファイル番号のカウント
set numFileCntNo to 0 as number
###ファイルの数だけ繰り返し
repeat with objSortedArrayM in ocidSortedArrayM
####拡張子名
set strExtension to objSortedArrayM's pathExtension as text
log
if strExtension is "" then
log "対象ファイル外なのでそのままにする"
else
####拡張子からUTI取得
set ocidUTType to (objUTType's typeWithFilenameExtension:strExtension)
set strUTI to ocidUTType's identifier as text
####UTIからMIME取得
set ocidFileMimeType to ocidUTType's preferredMIMEType()
set strFileMimeType to ocidFileMimeType as text
####ファイル名
set ocidFileName to objSortedArrayM's lastPathComponent
set strFileName to ocidFileName as text
####拡張子を除いたファイル名
set ocidPrefixName to ocidFileName's stringByDeletingPathExtension
#####ファイル名に加える『接頭名』を指定
####ファイル名用番号(2桁ゼロサプレス)
if boolRtoL is true then
set numFileCntNo to (numFileCntNo + 1) as number
set strSplitFileNo to "000" & numFileCntNo as text
set strSplitFileNo to text -3 through -1 of strSplitFileNo as text
set strRpageNameHeader to (strSplitFileNo & "_R_") as text
set strRpageName to (strRpageNameHeader & strFileName) as text
set strRsaveFilePath to (strDirPath & strRpageName) as text
set ocidDistFilePathR to (objNSURL's fileURLWithPath:strRsaveFilePath)

set numFileCntNo to (numFileCntNo + 1) as number
set strSplitFileNo to "000" & numFileCntNo as text
set strSplitFileNo to text -3 through -1 of strSplitFileNo as text
set strLpageNameHeader to (strSplitFileNo & "_L_") as text
set strLpageName to (strLpageNameHeader & strFileName) as text
set strLsaveFilePath to (strDirPath & strLpageName) as text
set ocidDistFilePathL to (objNSURL's fileURLWithPath:strLsaveFilePath)
else
set numFileCntNo to (numFileCntNo + 1) as number
set strSplitFileNo to "000" & numFileCntNo as text
set strSplitFileNo to text -3 through -1 of strSplitFileNo as text
set strLpageNameHeader to (strSplitFileNo & "_L_") as text
set strLpageName to (strLpageNameHeader & strFileName) as text
set strLsaveFilePath to (strDirPath & strLpageName) as text
set ocidDistFilePathL to (objNSURL's fileURLWithPath:strLsaveFilePath)


set numFileCntNo to (numFileCntNo + 1) as number
set strSplitFileNo to "000" & numFileCntNo as text
set strSplitFileNo to text -3 through -1 of strSplitFileNo as text
set strRpageNameHeader to (strSplitFileNo & "_R_") as text
set strRpageName to (strRpageNameHeader & strFileName) as text
set strRsaveFilePath to (strDirPath & strRpageName) as text
set ocidDistFilePathR to (objNSURL's fileURLWithPath:strRsaveFilePath)

end if

####MIMEの照合
if strFileMimeType is "image/jpeg" then
log "リストに項目がある"
set boolFileCopyDoneR to (objFileManager's copyItemAtPath:objSortedArrayM toPath:ocidDistFilePathR |error|:(boolean))
set boolFileCopyDoneL to (objFileManager's copyItemAtPath:objSortedArrayM toPath:ocidDistFilePathL |error|:(boolean))

if boolFileCopyDoneR is true then
log "Rファイルはコピーされました"
if boolFileCopyDoneL is true then
log "Lファイルはコピーされました"
#####NSURL NSStringURL
set ocidOrignalFileUrlPath to (objNSURL's fileURLWithPath:objSortedArrayM)
log "対象ファイル外なのでゴミ箱へ"
set boolGoToTrash to (objFileManager's trashItemAtURL:ocidOrignalFileUrlPath resultingItemURL:(missing value) |error|:(""))
if boolGoToTrash is true then
log "オリジナルファイルはゴミ箱へ入れました"
else
log "ゴミ箱へ入れるのを失敗しました"
end if
else if boolFileCopyDoneL is false then
log "Lファイルコピーは失敗しました"
end if
else if boolFileCopyDoneR is false then
log "Rファイルコピーは失敗しました"
end if

else if strFileMimeType is "image/png" then
log "リストに項目がある"
set boolFileCopyDoneR to (objFileManager's copyItemAtPath:objSortedArrayM toPath:ocidDistFilePathR |error|:(boolean))
set boolFileCopyDoneL to (objFileManager's copyItemAtPath:objSortedArrayM toPath:ocidDistFilePathL |error|:(boolean))
###左と右の分岐
if boolFileCopyDoneR is true then
log "Rファイルはコピーされました"
if boolFileCopyDoneL is true then
log "Lファイルはコピーされました"
#####NSURL NSStringURL
set ocidOrignalFileUrlPath to (objNSURL's fileURLWithPath:objSortedArrayM)
log "対象ファイル外なのでゴミ箱へ"
set boolGoToTrash to (objFileManager's trashItemAtURL:ocidOrignalFileUrlPath resultingItemURL:(missing value) |error|:(""))
if boolGoToTrash is true then
log "オリジナルファイルはゴミ箱へ入れました"
else
log "ゴミ箱へ入れるのを失敗しました"
end if
else if boolFileCopyDoneL is false then
log "Lファイルコピーは失敗しました"
end if
else if boolFileCopyDoneR is false then
log "Rファイルコピーは失敗しました"
end if

else
set numFileCntNo to (numFileCntNo - 2) as number
#####NSURL NSStringURL
set ocidOrignalFileUrlPath to (objNSURL's fileURLWithPath:objSortedArrayM)
log "対象ファイル外なのでゴミ箱へ"
set boolGoToTrash to (objFileManager's trashItemAtURL:ocidOrignalFileUrlPath resultingItemURL:(missing value) |error|:(""))
if boolGoToTrash is true then
log "オリジナルファイルはゴミ箱へ入れました"
else
log "ゴミ箱へ入れるのを失敗しました"
end if
end if

end if
end repeat

#############################################
(*
ここで、ファイルの複製(左用と右用)が出来たので
再度ファイルリストを取り直す
*)

###不可視ファイル以外のファイルを取得
set ocidContentsArrayNEW to objFileManager's contentsOfDirectoryAtURL:ocidDirUrlPath includingPropertiesForKeys:{ocidNSURLIsRegularFileKey} options:(objMe's NSDirectoryEnumerationSkipsHiddenFiles) |error|:(missing value)
####可変リストに変更
set ocidContentsArrayNewM to objNSMutableArray's arrayWithArray:ocidContentsArrayNEW
#####UNIXパス形式
set ocidContentsArrayNewM to ocidContentsArrayNewM's valueForKeyPath:"path"
###ローカライズ順でソート
set ocidSortedArrayNewM to (ocidContentsArrayNewM's sortedArrayUsingSelector:"localizedCompare:")

###ファイルの数だけ繰り返し
repeat with objSortedArrayNewM in ocidSortedArrayNewM
###パスで来るのでテキストに
set strSortedArrayNewMObj to objSortedArrayNewM as text
###パスをエイリアスに
set aliasContentsFilePath to POSIX file strSortedArrayNewMObj as alias
###########################
tell application "System Events"
set objKind to kind of aliasContentsFilePath
if objKind is "PNGイメージ" then
set boolKindChk to true as boolean
####PNG用の圧縮プロパティ
else if objKind is "JPEGイメージ" then
set boolKindChk to true as boolean
####JPEG用の圧縮プロパティ
else
set boolKindChk to false as boolean
end if
end tell

####NSStリングに
set ocidSortedFilePath to (objNSString's stringWithString:strSortedArrayNewMObj)
####ファイル名
set ocidFileName to ocidSortedFilePath's lastPathComponent
set strFileName to ocidFileName as text
####拡張子を除いたパス
set ocidSortedFileNamePath to ocidSortedFilePath's stringByDeletingPathExtension()
###拡張子
set strFileExtension to ocidSortedFilePath's pathExtension() as text
###保存パスここでは上書きなので同じにする
set ocidSaveFilePath to ocidSortedFilePath
####ファイルを読み込み NSBitmapImageRep
set ocidBitmapImageRepObj to (objNSBitmapImageRep's imageRepWithContentsOfFile:objSortedArrayNewM)
set numImageRepHight to ocidBitmapImageRepObj's pixelsHigh() as integer
set numImageRepWidth to ocidBitmapImageRepObj's pixelsWide() as integer
set numImageRepBytePerPlane to (numImageRepHight * numImageRepWidth) as integer
log numImageRepHight
log numImageRepWidth
log numImageRepBytePerPlane
####ページの半分の幅
set numImageRepWidthHarf to numImageRepWidth / 2 as integer
log numImageRepWidthHarf
#######ファイルを読み込み NSImage
set ocidNSImageFileObj to (objNSImage's alloc()'s initWithContentsOfFile:objSortedArrayNewM)
set recordSize to (ocidNSImageFileObj's |size|()) as record
set numNSImageHeight to height of recordSize as integer
set numNSImageWidth to width of recordSize as integer
set numNSImageBytePerPlane to (numNSImageHeight * numNSImageWidth) as integer
log numNSImageHeight
log numNSImageWidth
log numNSImageBytePerPlane
####ページの半分の幅
set numNSImageWidthHarf to numNSImageWidth / 2 as integer
log numNSImageWidthHarf
#### 解像度を求める
set numResolution to (((numImageRepBytePerPlane / numNSImageBytePerPlane) ^ 0.5) * 72) as integer
####NSImageのサイズで『半分の』サイズのNSBitmapImageRepを作成する
set ocidNewImageRep to (objNSBitmapImageRep's alloc()'s initWithBitmapDataPlanes:(missing value) pixelsWide:numNSImageWidthHarf pixelsHigh:numNSImageHeight bitsPerSample:8 samplesPerPixel:4 hasAlpha:true isPlanar:false colorSpaceName:(objMe's NSCalibratedRGBColorSpace) bitmapFormat:(objMe's NSAlphaFirstBitmapFormat) bytesPerRow:0 bitsPerPixel:32)
####処理開始
objNSGraphicsContext's saveGraphicsState()
#####半分サイズのイメージをgraphicsContextに変換
(objNSGraphicsContext's setCurrentContext:(objNSGraphicsContext's graphicsContextWithBitmapImageRep:ocidNewImageRep))
objMe's NSColor's grayColor()'s |set|()
#### 座標と幅高さを指定
objMe's NSRectFill({origin:{x:0, y:0}, |size|:{width:numNSImageWidthHarf, height:numNSImageHeight}})

if boolRtoL is true then
#####右から左へのパターン
if strFileName contains "_R_" then
###新規画像の座標00に開いた画像の座標00を描画する
(ocidBitmapImageRepObj's drawInRect:{origin:{x:0, y:0}, |size|:{width:numNSImageWidthHarf, height:numNSImageHeight}} fromRect:{origin:{x:numNSImageWidthHarf, y:0}, |size|:{width:numNSImageWidthHarf, height:numNSImageHeight}} operation:(objMe's NSCompositeSourceOver) fraction:1.0 respectFlipped:true hints:(missing value))
else if strFileName contains "_L_" then
#####新規画像の座標00に開いた画像の座標幅を半分にした部分でを描画する
(ocidBitmapImageRepObj's drawInRect:{origin:{x:0, y:0}, |size|:{width:numImageRepWidthHarf, height:numImageRepHight}} fromRect:{origin:{x:0, y:0}, |size|:{width:numImageRepWidthHarf, height:numImageRepHight}} operation:(objMe's NSCompositeSourceOver) fraction:1.0 respectFlipped:true hints:(missing value))
else
return false
end if
else if boolRtoL is false then
#####右から左へのパターン
if strFileName contains "_L_" then
###新規画像の座標00に開いた画像の座標00を描画する
(ocidBitmapImageRepObj's drawInRect:{origin:{x:0, y:0}, |size|:{width:numImageRepWidthHarf, height:numImageRepHight}} fromRect:{origin:{x:0, y:0}, |size|:{width:numImageRepWidthHarf, height:numImageRepHight}} operation:(objMe's NSCompositeSourceOver) fraction:1.0 respectFlipped:true hints:(missing value))
else if strFileName contains "_R_" then
#####新規画像の座標00に開いた画像の座標幅を半分にした部分でを描画する
(ocidBitmapImageRepObj's drawInRect:{origin:{x:0, y:0}, |size|:{width:numNSImageWidthHarf, height:numNSImageHeight}} fromRect:{origin:{x:numNSImageWidthHarf, y:0}, |size|:{width:numNSImageWidthHarf, height:numNSImageHeight}} operation:(objMe's NSCompositeSourceOver) fraction:1.0 respectFlipped:true hints:(missing value))
else
return false
end if
end if
####処理終了
objNSGraphicsContext's restoreGraphicsState()

###########################
tell application "System Events"
set objKind to kind of aliasContentsFilePath
if objKind is "PNGイメージ" then
set boolKindChk to true as boolean
####PNG用の圧縮プロパティで出力用フォーマットに変換
set ocidInlineImageData to (ocidNewImageRep's representationUsingType:(objMe's NSPNGFileType) |properties|:{NSImageInterlaced:true})
else if objKind is "JPEGイメージ" then
set boolKindChk to true as boolean
####JPEG用の圧縮プロパティで出力用フォーマットに変換
set ocidInlineImageData to (ocidNewImageRep's representationUsingType:(objMe's NSJPEGFileType) |properties|:{NSImageCompressionFactor:0.9, NSImageProgressive:false})
else
set boolKindChk to false as boolean
return false
end if
end tell
(ocidInlineImageData's writeToFile:ocidSaveFilePath atomically:true)

set ocidInlineImageData to ""
set ocidBitmapImageRepObj to ""
end repeat



#########################ログ表示
to doLogView()

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
end if
end repeat

end doLogView
#########################

|

[Resolution]解像度を求める

たぶん、もっとスマートな方法があるに違いない

#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7

use AppleScript version "2.8"
use framework "Foundation"
use scripting additions

property objMe : a reference to current application
property objNSString : a reference to objMe's NSString
property objNSImage : a reference to NSImage
property objNSBitmapImageRep : a reference to NSBitmapImageRep

######ログ表示
doLogView()
###動作確認している分だけ
set listUTI to {"public.jpeg", "public.png", "org.webmproject.webp", "public.heic", "public.bmp"}
###ダイアログのデフォルトロケーション
tell application "Finder"
## set aliasDefaultLocation to container of (path to me) as alias
set aliasDefaultLocation to (path to desktop folder from user domain) as alias
end tell

###ダイアログ
set aliasFile to (choose file with prompt "ファイルを選んでください" default location (aliasDefaultLocation) of type listUTI with invisibles and showing package contents without multiple selections allowed) as alias

###エイリアスをUNIXパスに
set strFilePath to POSIX path of aliasFile as text

####NSBitmapImageRepの処理
set ocidBitmapImageRepObj to (objNSBitmapImageRep's imageRepWithContentsOfFile:strFilePath)
###
set numImageRepHight to ocidBitmapImageRepObj's pixelsHigh() as integer
###
set numImageRepWide to ocidBitmapImageRepObj's pixelsWide() as integer
####ピクセル数
set numImageRepBytePerPlane to (numImageRepHight * numImageRepWide) as integer

log numImageRepHight
log numImageRepWide
log numImageRepBytePerPlane
#####NSImageの処理
set ocidNSImageFileObj to (objNSImage's alloc()'s initWithContentsOfFile:strFilePath)
set recordSize to (ocidNSImageFileObj's |size|()) as record
###
set numNSImageHeight to height of recordSize as integer
###
set numNSImageWidth to width of recordSize as integer
####ピクセル数
set numNSImageBytePerPlane to (numNSImageHeight * numNSImageWidth) as integer
log numNSImageHeight
log numNSImageWidth
log numNSImageBytePerPlane
####解像度を求める
set numResolution to (((numImageRepBytePerPlane / numNSImageBytePerPlane) ^ 0.5) * 72) as integer


log numResolution





#########################ログ表示
to doLogView()

tell application "System Events"
set listAppList to title of (every process where background only is false)
end tell
repeat with objAppList in listAppList
set strAppList to objAppList as text
if strAppList is "スクリプトエディタ" then
tell application "Script Editor"
if frontmost is true then
try
tell application "System Events" to click menu item "ログを表示" of menu "表示" of menu bar item "表示" of menu bar 1 of application process "Script Editor"
end try
end if
end tell
end if
end repeat

end doLogView
#########################

|

[Image Events]FileとAliasによる挙動

要はこの違いです

set strImageFilePath to "/Library/User Pictures/Animals/Eagle.tif"

set fileImageFilePath to POSIX file strImageFilePath
---> file "

set aliasImageFilePath to (POSIX file strImageFilePath) as alias
---> alias "



結論を先に
1:ファイル単体:Fileパス形式でImage Eventsに渡す
2:リスト形式の場合:aliasリスト形式でImage Eventsに渡す
これが現時点での使用方法なのかなと



例 ファイルが単体の場合


fileだと各種値を取得できます
set strImageFilePath to "/Library/User Pictures/Animals/Eagle.tif"

set fileImageFilePath to POSIX file strImageFilePath
---> file "

tell application "Image Events"
launch
set objImage to open fileImageFilePath
set listResolution to (resolution of objImage) as list
set listDimensions to (dimensions of objImage) as list
set strR to item 1 of listResolution as text
set strW to item 1 of listDimensions as text
set strH to item 2 of listDimensions as text
set strColorSpace to (color space of objImage) as text
set strFileType to (file type of objImage) as text
set strFileName to (name of objImage) as text
##set strEmbeddedProfileof to name of (embedded profile of objImage)
close objImage
end tell

##########
tell application "Image Events"
launch
open file "Macintosh HD:Library:User Pictures:Animals:Eagle.tif"
--> image "Eagle.tif"
get resolution of image "Eagle.tif"
--> {72.0, 72.0}
get dimensions of image "Eagle.tif"
--> {512, 512}
get color space of image "Eagle.tif"
--> RGB
get file type of image "Eagle.tif"
--> TIFF
get name of image "Eagle.tif"
--> "Eagle.tif"
close image "Eagle.tif"
end tell


エイリアスをOPENすると値は取得できません。

set strImageFilePath to "/Library/User Pictures/Animals/Eagle.tif"

set aliasImageFilePath to (POSIX file strImageFilePath) as alias
---> alias "

tell application "Image Events"
launch
set objImage to open aliasImageFilePath
set listResolution to (resolution of objImage) as list
set listDimensions to (dimensions of objImage) as list
set strR to item 1 of listResolution as text
set strW to item 1 of listDimensions as text
set strH to item 2 of listDimensions as text
set strColorSpace to (color space of objImage) as text
set strFileType to (file type of objImage) as text
set strFileName to (name of objImage) as text
##set strEmbeddedProfileof to name of (embedded profile of objImage)
close objImage
end tell

###
#missing valueとなって値を取得できません



リスト形式の場合


フォルダの中にあるファイルのリスト
set strImageDIr to "/Library/User Pictures/Animals"

set aliasImageDIr to (POSIX file strImageDIr) as alias
---> alias "Macintosh HD:Library:User Pictures:Animals:"

tell application "Finder"
set objEveryDoc to (every file of aliasImageDIr)
end tell
--->get every file of alias "Macintosh HD:Library:User Pictures:Animals:"
--> {document file }


フォルダの中にあるファイルのエイリアスのリスト

tell application "Finder"
set listAliasPath to every file in aliasImageDIr as alias list
end tell
-->get every file of alias "Macintosh HD:Library:User Pictures:Animals:"
--> {alias }




ファイルのリストの場合
set strImageDIr to "/Library/User Pictures/Animals"

set aliasImageDIr to (POSIX file strImageDIr) as alias
---> alias "Macintosh HD:Library:User Pictures:Animals:"

tell application "Finder"
set objEveryDoc to (every file of aliasImageDIr)
end tell

tell application "Image Events"
launch
set objImage to open (item 1 of objEveryDoc)
set listResolution to (resolution of objImage) as list
set listDimensions to (dimensions of objImage) as list
set strR to item 1 of listResolution as text
set strW to item 1 of listDimensions as text
set strH to item 2 of listDimensions as text
set strColorSpace to (color space of objImage) as text
set strFileType to (file type of objImage) as text
set strFileName to (name of objImage) as text
##set strEmbeddedProfileof to name of (embedded profile of objImage)
close objImage
end tell

###
#イメージファイルを対応のアプリで開いてしまいますので、値を取れません。



エリアスリストの場合は期待通りの動作となります


set strImageDIr to "/Library/User Pictures/Animals"

set aliasImageDir to (POSIX file strImageDIr) as alias
---> alias "Macintosh HD:Library:User Pictures:Animals:"

tell application "Finder"
set listAliasPath to every file in aliasImageDir as alias list
end tell

tell application "Image Events"
launch
set objImage to open item 1 of listAliasPath
set listResolution to (resolution of objImage) as list
set listDimensions to (dimensions of objImage) as list
set strR to item 1 of listResolution as text
set strW to item 1 of listDimensions as text
set strH to item 2 of listDimensions as text
set strColorSpace to (color space of objImage) as text
set strFileType to (file type of objImage) as text
set strFileName to (name of objImage) as text
##set strEmbeddedProfileof to name of (embedded profile of objImage)
close objImage
end tell

tell application "Image Events"
launch
open alias "Macintosh HD:Library:User Pictures:Animals:Eagle.tif"
--> image "Eagle.tif"
get resolution of image "Eagle.tif"
--> {72.0, 72.0}
get dimensions of image "Eagle.tif"
--> {512, 512}
get color space of image "Eagle.tif"
--> RGB
get file type of image "Eagle.tif"
--> TIFF
get name of image "Eagle.tif"
--> "Eagle.tif"
close image "Eagle.tif"
end tell

|

[NSImageRep]イメージデータの縦横を取得する

ダウンロード - nsimagerep.scpt.zip




#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
(*
Class
NSImageRep
https://developer.apple.com/documentation/appkit/nsimagerep
*)
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7

use AppleScript version "2.8"

use scripting additions
use framework "Foundation"
use framework "AppKit"
property objMe : a reference to current application
###property objNSImage : a reference to objMe's objNSImage
property objNSColorSpaceName : a reference to objMe's NSColorSpaceName

set aliasDefDir to path to desktop folder from user domain


set listChooseFile to (choose file with prompt "ファイルを選んでください" default location aliasDefDir of type {"public.image"} with invisibles and multiple selections allowed without showing package contents) as list


repeat with objFile in listChooseFile

set theFilePath to POSIX path of objFile
set imageInfo to (objMe's NSBitmapImageRep's imageRepWithContentsOfFile:theFilePath)


tell imageInfo
log bitsPerSample()
#####
log pixelsHigh()
log pixelsWide()
#####
log pixelsHigh()
log pixelsWide()
#####
log bitsPerPixel()
log bytesPerPlane()
log bitmapFormat()
log samplesPerPixel()
log hasAlpha()
log isOpaque()
log isPlanar()
log layoutDirection()

log colorSpaceName()

end tell




end repeat

|

[Image Events]macOS12でImage Eventsを使う

macOS12でImage Eventsを使うときのポイント
要点はファイルを『エイリアスのリスト』で渡す事でした

ダウンロード - image20events.scpt.zip




tell application "Image Events"
launch
set objImage to open item numImageCnt of listChooseFile
set listResolution to (resolution of objImage) as list
set listDimensions to (dimensions of objImage) as list
set strR to item 1 of listResolution as text
set strW to item 1 of listDimensions as text
set strH to item 2 of listDimensions as text
set strColorSpace to (color space of objImage) as text
set strFileType to (file type of objImage) as text
set strFileName to (name of objImage) as text
set strEmbeddedProfileof to name of (embedded profile of objImage)
close objImage
end tell


#!/usr/bin/env osascript
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
#
#
#
#
# com.cocolog-nifty.quicktimer.icefloe
----+----1----+----2----+-----3----+----4----+----5----+----6----+----7

use AppleScript version "2.8"
use framework "Foundation"
use scripting additions
property objMe : a reference to current application
property objNSString : a reference to objMe's NSString





set aliasDefDir to path to desktop folder from user domain


set listChooseFile to (choose file with prompt "ファイルを選んでください" default location aliasDefDir of type {"public.image"} with invisibles and multiple selections allowed without showing package contents) as list


set cntImageFile to (count of listChooseFile) as number
set numImageCnt to 1
repeat cntImageFile times

tell application "Finder"

set objInfo to info for item numImageCnt of listChooseFile
set strFinderName to name of objInfo
set strFinderSize to size of objInfo
set strCreationDate to creation date of objInfo
set strkind to kind of objInfo
set strUTI to type identifier of objInfo

set textMbPer to "0.0009765625" as text
set textKbPer to "0.001" as text
log objInfo
set numKb to round (strFinderSize * textKbPer)
set numMb to (numKb * textMbPer)
set strOutPut to ""


set strOutPut to strOutPut & "@@@@@@@@@@@@@@@@@@@@@\n"
set strOutPut to strOutPut & "##############Finder\n"
set strOutPut to strOutPut & "FinderName\t" & strFinderName & "\n"
set strOutPut to strOutPut & "FinderSize\t" & strFinderSize & " バイト\n"
set strOutPut to strOutPut & "FinderSize\t" & numKb & " KB\n"
set strOutPut to strOutPut & "FinderSize\t" & numMb & " MB\n"
set strOutPut to strOutPut & "kind\t" & strkind & "\n"
set strOutPut to strOutPut & "type identifier\t" & strUTI & "\n"

set strOutPut to strOutPut & "CreationDate\t" & strCreationDate & "\n"



end tell


tell application "Image Events"
launch
set objImage to open item numImageCnt of listChooseFile
set listResolution to (resolution of objImage) as list
set listDimensions to (dimensions of objImage) as list
set strR to item 1 of listResolution as text
set strW to item 1 of listDimensions as text
set strH to item 2 of listDimensions as text
set strColorSpace to (color space of objImage) as text
set strFileType to (file type of objImage) as text
set strFileName to (name of objImage) as text
set strEmbeddedProfileof to name of (embedded profile of objImage)
close objImage
end tell

set strOutPut to strOutPut & "##############Image Events\n"
set strOutPut to strOutPut & "resolution\t" & strR & "\n"
set strOutPut to strOutPut & "dimensionsW\t" & strW & "\n"
set strOutPut to strOutPut & "dimensionsH\t" & strH & "\n"
set strOutPut to strOutPut & "ColorSpace\t" & strColorSpace & "\n"
set strOutPut to strOutPut & "FileType\t" & strFileType & "\n"
set strOutPut to strOutPut & "FileName\t" & strFileName & "\n"
set strOutPut to strOutPut & "embedded profile\t" & strEmbeddedProfileof & "\n"

log strOutPut



set numImageCnt to numImageCnt + 1
end repeat


tell current application
path to desktop from user domain
--> alias "Macintosh HD:Users:XXXXXXXXX:Desktop:"
end tell
tell application "Script Editor"
choose file with prompt "ファイルを選んでください" default location alias "Macintosh HD:Users:XXXXXXX:Desktop:" of type {"public.image"} with invisibles and multiple selections allowed without showing package contents
--> {alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Aerial.heic", alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Coastline.heic", alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Dark.heic", alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic Dark.heic", alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic Light.heic", alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic.heic"}
end tell
tell application "Finder"
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Aerial.heic"
--> error number -10004
end tell
tell current application
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Aerial.heic"
--> {name:"Big Sur Aerial.heic", creation date:date "2022226 土曜日 16:05:07", modification date:date "2022226 土曜日 16:05:07", size:29804, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"heic", displayed name:"Big Sur Aerial.heic", default application:alias "Macintosh HD:System:Applications:Preview.app:", kind:"HEIFイメージ", file type:"", file creator:"", type identifier:"public.heic", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "Finder"
(*name:Big Sur Aerial.heic, creation date:date 2022226 土曜日 16:05:07, modification date:date 2022226 土曜日 16:05:07, size:29804, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:heic, displayed name:Big Sur Aerial.heic, default application:alias Macintosh HD:System:Applications:Preview.app:, kind:HEIFイメージ, file type:, file creator:, type identifier:public.heic, locked:false, busy status:false, short version:, long version:*)
end tell
tell current application
round 29.804
--> 30
end tell
tell application "Image Events"
launch
open alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Aerial.heic"
--> image "Big Sur Aerial.heic"
get resolution of image "Big Sur Aerial.heic"
--> {300.0, 300.0}
get dimensions of image "Big Sur Aerial.heic"
--> {356, 356}
get color space of image "Big Sur Aerial.heic"
--> RGB
get file type of image "Big Sur Aerial.heic"
--> missing value
get name of image "Big Sur Aerial.heic"
--> "Big Sur Aerial.heic"
get name of embedded profile of image "Big Sur Aerial.heic"
--> "Display P3"
close image "Big Sur Aerial.heic"
end tell
(*@@@@@@@@@@@@@@@@@@@@@
##############Finder
FinderNameBig Sur Aerial.heic
FinderSize29804 バイト
FinderSize30 KB
FinderSize0.029296875 MB
kindHEIFイメージ
type identifierpublic.heic
CreationDate2022226 土曜日 16:05:07
##############Image Events
resolution300.0
dimensionsW356
dimensionsH356
ColorSpaceRGB
FileTypemissing value
FileNameBig Sur Aerial.heic
embedded profileDisplay P3
*)
tell application "Finder"
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Coastline.heic"
--> error number -10004
end tell
tell current application
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Coastline.heic"
--> {name:"Big Sur Coastline.heic", creation date:date "2022226 土曜日 16:05:07", modification date:date "2022226 土曜日 16:05:07", size:42490, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"heic", displayed name:"Big Sur Coastline.heic", default application:alias "Macintosh HD:System:Applications:Preview.app:", kind:"HEIFイメージ", file type:"", file creator:"", type identifier:"public.heic", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "Finder"
(*name:Big Sur Coastline.heic, creation date:date 2022226 土曜日 16:05:07, modification date:date 2022226 土曜日 16:05:07, size:42490, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:heic, displayed name:Big Sur Coastline.heic, default application:alias Macintosh HD:System:Applications:Preview.app:, kind:HEIFイメージ, file type:, file creator:, type identifier:public.heic, locked:false, busy status:false, short version:, long version:*)
end tell
tell current application
round 42.49
--> 42
end tell
tell application "Image Events"
launch
open alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Coastline.heic"
--> image "Big Sur Coastline.heic"
get resolution of image "Big Sur Coastline.heic"
--> {72.0, 72.0}
get dimensions of image "Big Sur Coastline.heic"
--> {356, 356}
get color space of image "Big Sur Coastline.heic"
--> RGB
get file type of image "Big Sur Coastline.heic"
--> missing value
get name of image "Big Sur Coastline.heic"
--> "Big Sur Coastline.heic"
get name of embedded profile of image "Big Sur Coastline.heic"
--> "Display P3"
close image "Big Sur Coastline.heic"
end tell
(*@@@@@@@@@@@@@@@@@@@@@
##############Finder
FinderNameBig Sur Coastline.heic
FinderSize42490 バイト
FinderSize42 KB
FinderSize0.041015625 MB
kindHEIFイメージ
type identifierpublic.heic
CreationDate2022226 土曜日 16:05:07
##############Image Events
resolution72.0
dimensionsW356
dimensionsH356
ColorSpaceRGB
FileTypemissing value
FileNameBig Sur Coastline.heic
embedded profileDisplay P3
*)
tell application "Finder"
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Dark.heic"
--> error number -10004
end tell
tell current application
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Dark.heic"
--> {name:"Big Sur Dark.heic", creation date:date "2022226 土曜日 16:05:07", modification date:date "2022226 土曜日 16:05:07", size:21911, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"heic", displayed name:"Big Sur Dark.heic", default application:alias "Macintosh HD:System:Applications:Preview.app:", kind:"HEIFイメージ", file type:"", file creator:"", type identifier:"public.heic", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "Finder"
(*name:Big Sur Dark.heic, creation date:date 2022226 土曜日 16:05:07, modification date:date 2022226 土曜日 16:05:07, size:21911, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:heic, displayed name:Big Sur Dark.heic, default application:alias Macintosh HD:System:Applications:Preview.app:, kind:HEIFイメージ, file type:, file creator:, type identifier:public.heic, locked:false, busy status:false, short version:, long version:*)
end tell
tell current application
round 21.911
--> 22
end tell
tell application "Image Events"
launch
open alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Dark.heic"
--> image "Big Sur Dark.heic"
get resolution of image "Big Sur Dark.heic"
--> {72.0, 72.0}
get dimensions of image "Big Sur Dark.heic"
--> {356, 356}
get color space of image "Big Sur Dark.heic"
--> RGB
get file type of image "Big Sur Dark.heic"
--> missing value
get name of image "Big Sur Dark.heic"
--> "Big Sur Dark.heic"
get name of embedded profile of image "Big Sur Dark.heic"
--> "Display P3"
close image "Big Sur Dark.heic"
end tell
(*@@@@@@@@@@@@@@@@@@@@@
##############Finder
FinderNameBig Sur Dark.heic
FinderSize21911 バイト
FinderSize22 KB
FinderSize0.021484375 MB
kindHEIFイメージ
type identifierpublic.heic
CreationDate2022226 土曜日 16:05:07
##############Image Events
resolution72.0
dimensionsW356
dimensionsH356
ColorSpaceRGB
FileTypemissing value
FileNameBig Sur Dark.heic
embedded profileDisplay P3
*)
tell application "Finder"
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic Dark.heic"
--> error number -10004
end tell
tell current application
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic Dark.heic"
--> {name:"Big Sur Graphic Dark.heic", creation date:date "2022226 土曜日 16:05:07", modification date:date "2022226 土曜日 16:05:07", size:27119, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"heic", displayed name:"Big Sur Graphic Dark.heic", default application:alias "Macintosh HD:System:Applications:Preview.app:", kind:"HEIFイメージ", file type:"", file creator:"", type identifier:"public.heic", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "Finder"
(*name:Big Sur Graphic Dark.heic, creation date:date 2022226 土曜日 16:05:07, modification date:date 2022226 土曜日 16:05:07, size:27119, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:heic, displayed name:Big Sur Graphic Dark.heic, default application:alias Macintosh HD:System:Applications:Preview.app:, kind:HEIFイメージ, file type:, file creator:, type identifier:public.heic, locked:false, busy status:false, short version:, long version:*)
end tell
tell current application
round 27.119
--> 27
end tell
tell application "Image Events"
launch
open alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic Dark.heic"
--> image "Big Sur Graphic Dark.heic"
get resolution of image "Big Sur Graphic Dark.heic"
--> {72.0, 72.0}
get dimensions of image "Big Sur Graphic Dark.heic"
--> {356, 356}
get color space of image "Big Sur Graphic Dark.heic"
--> RGB
get file type of image "Big Sur Graphic Dark.heic"
--> missing value
get name of image "Big Sur Graphic Dark.heic"
--> "Big Sur Graphic Dark.heic"
get name of embedded profile of image "Big Sur Graphic Dark.heic"
--> "Display P3"
close image "Big Sur Graphic Dark.heic"
end tell
(*@@@@@@@@@@@@@@@@@@@@@
##############Finder
FinderNameBig Sur Graphic Dark.heic
FinderSize27119 バイト
FinderSize27 KB
FinderSize0.0263671875 MB
kindHEIFイメージ
type identifierpublic.heic
CreationDate2022226 土曜日 16:05:07
##############Image Events
resolution72.0
dimensionsW356
dimensionsH356
ColorSpaceRGB
FileTypemissing value
FileNameBig Sur Graphic Dark.heic
embedded profileDisplay P3
*)
tell application "Finder"
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic Light.heic"
--> error number -10004
end tell
tell current application
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic Light.heic"
--> {name:"Big Sur Graphic Light.heic", creation date:date "2022226 土曜日 16:05:07", modification date:date "2022226 土曜日 16:05:07", size:30874, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"heic", displayed name:"Big Sur Graphic Light.heic", default application:alias "Macintosh HD:System:Applications:Preview.app:", kind:"HEIFイメージ", file type:"", file creator:"", type identifier:"public.heic", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "Finder"
(*name:Big Sur Graphic Light.heic, creation date:date 2022226 土曜日 16:05:07, modification date:date 2022226 土曜日 16:05:07, size:30874, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:heic, displayed name:Big Sur Graphic Light.heic, default application:alias Macintosh HD:System:Applications:Preview.app:, kind:HEIFイメージ, file type:, file creator:, type identifier:public.heic, locked:false, busy status:false, short version:, long version:*)
end tell
tell current application
round 30.874
--> 31
end tell
tell application "Image Events"
launch
open alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic Light.heic"
--> image "Big Sur Graphic Light.heic"
get resolution of image "Big Sur Graphic Light.heic"
--> {72.0, 72.0}
get dimensions of image "Big Sur Graphic Light.heic"
--> {356, 356}
get color space of image "Big Sur Graphic Light.heic"
--> RGB
get file type of image "Big Sur Graphic Light.heic"
--> missing value
get name of image "Big Sur Graphic Light.heic"
--> "Big Sur Graphic Light.heic"
get name of embedded profile of image "Big Sur Graphic Light.heic"
--> "Display P3"
close image "Big Sur Graphic Light.heic"
end tell
(*@@@@@@@@@@@@@@@@@@@@@
##############Finder
FinderNameBig Sur Graphic Light.heic
FinderSize30874 バイト
FinderSize31 KB
FinderSize0.0302734375 MB
kindHEIFイメージ
type identifierpublic.heic
CreationDate2022226 土曜日 16:05:07
##############Image Events
resolution72.0
dimensionsW356
dimensionsH356
ColorSpaceRGB
FileTypemissing value
FileNameBig Sur Graphic Light.heic
embedded profileDisplay P3
*)
tell application "Finder"
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic.heic"
--> error number -10004
end tell
tell current application
info for alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic.heic"
--> {name:"Big Sur Graphic.heic", creation date:date "2022226 土曜日 16:05:07", modification date:date "2022226 土曜日 16:05:07", size:32724, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:"heic", displayed name:"Big Sur Graphic.heic", default application:alias "Macintosh HD:System:Applications:Preview.app:", kind:"HEIFイメージ", file type:"", file creator:"", type identifier:"public.heic", locked:false, busy status:false, short version:"", long version:""}
end tell
tell application "Finder"
(*name:Big Sur Graphic.heic, creation date:date 2022226 土曜日 16:05:07, modification date:date 2022226 土曜日 16:05:07, size:32724, folder:false, alias:false, package folder:false, visible:true, extension hidden:false, name extension:heic, displayed name:Big Sur Graphic.heic, default application:alias Macintosh HD:System:Applications:Preview.app:, kind:HEIFイメージ, file type:, file creator:, type identifier:public.heic, locked:false, busy status:false, short version:, long version:*)
end tell
tell current application
round 32.724
--> 33
end tell
tell application "Image Events"
launch
open alias "Macintosh HD:System:Library:Desktop Pictures:.thumbnails:Big Sur Graphic.heic"
--> image "Big Sur Graphic.heic"
get resolution of image "Big Sur Graphic.heic"
--> {72.0, 72.0}
get dimensions of image "Big Sur Graphic.heic"
--> {356, 356}
get color space of image "Big Sur Graphic.heic"
--> RGB
get file type of image "Big Sur Graphic.heic"
--> missing value
get name of image "Big Sur Graphic.heic"
--> "Big Sur Graphic.heic"
get name of embedded profile of image "Big Sur Graphic.heic"
--> "Display P3"
close image "Big Sur Graphic.heic"
end tell
(*@@@@@@@@@@@@@@@@@@@@@
##############Finder
FinderNameBig Sur Graphic.heic
FinderSize32724 バイト
FinderSize33 KB
FinderSize0.0322265625 MB
kindHEIFイメージ
type identifierpublic.heic
CreationDate2022226 土曜日 16:05:07
##############Image Events
resolution72.0
dimensionsW356
dimensionsH356
ColorSpaceRGB
FileTypemissing value
FileNameBig Sur Graphic.heic
embedded profileDisplay P3
*)

|

その他のカテゴリー

Acrobat Acrobat Annotation Acrobat Dialog Acrobat Form Acrobat JS Acrobat Open Acrobat Plugin Acrobat python Acrobat Reader Acrobat Sequ Acrobat Stamps Admin Admin Account Admin Apachectl Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Permission Admin Pkg Admin Power Management Admin Printer Admin SetUp Admin SMB Admin System Information Admin Tools Admin Users Admin Volumes Adobe Apple AppleScript AppleScript Guide AppleScript Accessibility AppleScript AppKit AppleScript Applications AppleScript AppStore AppleScript Archive AppleScript Attributes AppleScript Automator AppleScript AVAsset AppleScript AVconvert AppleScript AVFoundation AppleScript AVURLAsset AppleScript BackUp AppleScript Barcode AppleScript Bash AppleScript Basic AppleScript Basic Path AppleScript Bluetooth AppleScript BOX AppleScript Browser AppleScript Calendar AppleScript CD/DVD AppleScript Choose AppleScript Chrome AppleScript CIImage AppleScript CloudStorage AppleScript Color AppleScript com.apple.LaunchServices.OpenWith AppleScript Console AppleScript Contacts AppleScript CotEditor AppleScript CURL AppleScript current application AppleScript Date&Time AppleScript delimiters AppleScript Desktop AppleScript Device AppleScript Disk AppleScript do shell script AppleScript Dock AppleScript DropBox AppleScript eMail AppleScript Encode Decode AppleScript Error AppleScript EXIFData AppleScript ffmpeg AppleScript File AppleScript Finder AppleScript Firefox AppleScript Folder AppleScript Fonts AppleScript GIF AppleScript HTML AppleScript Icon AppleScript Illustrator AppleScript Image Events AppleScript Image2PDF AppleScript ImageOptim Applescript iWork AppleScript Javascript AppleScript Jedit AppleScript Json AppleScript Label AppleScript List AppleScript locationd AppleScript LRC AppleScript LSSharedFileList AppleScript m3u8 AppleScript MakePDF AppleScript Map AppleScript Math AppleScript Microsoft AppleScript Microsoft Edge AppleScript Microsoft Excel AppleScript Mobileconfig AppleScript Mouse AppleScript Movie AppleScript Music AppleScript NetWork AppleScript Notes AppleScript NSArray AppleScript NSBitmapImageRep AppleScript NSBundle AppleScript NSCFBoolean AppleScript NSCharacterSet AppleScript NSColor AppleScript NSColorList AppleScript NSData AppleScript NSDictionary AppleScript NSError AppleScript NSEvent AppleScript NSFileAttributes AppleScript NSFileManager AppleScript NSFont AppleScript NSFontManager AppleScript NSImage AppleScript NSIndex AppleScript NSKeyedArchiver AppleScript NSKeyedUnarchiver AppleScript NSLocale AppleScript NSMutableArray AppleScript NSMutableDictionary AppleScript NSMutableString AppleScript NSNotFound AppleScript NSNumber AppleScript NSOpenPanel AppleScript NSPasteboard AppleScript NSPDFImageRep AppleScript NSpoint AppleScript NSPredicate AppleScript NSRange AppleScript NSRegularExpression AppleScript NSRunningApplication AppleScript NSScreen AppleScript NSSize AppleScript NSString AppleScript NSStringCompareOptions AppleScript NSTask AppleScript NSTimeZone AppleScript NSURL AppleScript NSURL File AppleScript NSURLBookmark AppleScript NSURLComponents AppleScript NSURLResourceKey AppleScript NSUserDefaults AppleScript NSUUID AppleScript NSView AppleScript NSWorkspace AppleScript Numbers AppleScript OAuth AppleScript ObjC AppleScript OneDrive AppleScript Osax AppleScript PDF AppleScript PDFAnnotationWidget AppleScript PDFContext AppleScript PDFDisplayBox AppleScript PDFDocumentPermissions AppleScript PDFKit AppleScript PDFnUP AppleScript PDFOutline AppleScript Photos AppleScript Photoshop AppleScript Plist System Events AppleScript PostScript AppleScript prefPane AppleScript Preview AppleScript Python AppleScript QR AppleScript QR Decode AppleScript QuickLook AppleScript QuickTime AppleScript record AppleScript Regular Expression AppleScript Reminders AppleScript ReName AppleScript Repeat AppleScript RTF AppleScript Safari AppleScript SaveFile AppleScript ScreenCapture AppleScript ScreenSaver AppleScript Script Editor AppleScript Script Menu AppleScript Shortcuts AppleScript Shortcuts Events AppleScript Sort AppleScript Sound AppleScript Spotlight AppleScript SRT AppleScript StandardAdditions AppleScript stringByApplyingTransform AppleScript System Events AppleScript System Settings AppleScript TemporaryItems AppleScript Terminal AppleScript Text AppleScript Text CSV AppleScript Text TSV AppleScript TextEdit AppleScript Translate AppleScript Trash AppleScript Twitter AppleScript UI AppleScript Unit Conversion AppleScript UTType AppleScript valueForKeyPath AppleScript Video AppleScript VisionKit AppleScript Visual Studio Code AppleScript webarchive AppleScript webp AppleScript Wifi AppleScript XML AppleScript XML EPUB AppleScript XML OPML AppleScript XML Plist AppleScript XML RSS AppleScript XML SVG AppleScript XML TTML AppleScript XML webloc AppleScript YouTube AppleScript Zero Suppress Applications Barcode OnLine Tools CityCode Design iPhone List Logs lsappinfo Memo Music perl PlistBuddy pluginkit postalcode ReadMe SF Symbols character id SF Symbols Entity sips Skype Slack sqlite TCC Tools Typography Video Wacom zoom