« [sips]画像の操作 rotate flip horizontal flip vertical | トップページ | [sips]画像のリサンプル resampleHeightWidth resampleHeightWidthMax »

[sips]画像のCROP

cropToHeightWidth
/usr/bin/sips "/System/Library/Desktop Pictures/Monterey Graphic.heic" --cropToHeightWidth 720 1280 -o ~/Desktop/cropToHeightWidth.jpg

cropOffset
/usr/bin/sips "/System/Library/Desktop Pictures/Monterey Graphic.heic" --cropToHeightWidth 720 1280 --cropOffset 480 480 -o ~/Desktop/cropOffset.jpg


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



#!/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 scripting additions

set aliasLocationPath to (path to desktop pictures folder from system domain)
set aliasImageFilePath to (choose file of type {"public.image", "public.tiff", "public.png", "public.jpeg", "com.adobe.photoshop-image", "public.heic"} with prompt "ファイルを選んで" default location aliasLocationPath without invisibles, showing package contents and multiple selections allowed)

set theImageFilePath to POSIX path of aliasImageFilePath as text


set numWidth to 1280 as number
set numHeight to 720 as number

########
set theCommandText to ("/usr/bin/sips --cropToHeightWidth " & numHeight & " " & numWidth & " \"" & theImageFilePath & "\" --setProperty format png -o ~/Desktop/cropToHeightWidth.png") as text
log "theCommandText:" & theCommandText
do shell script theCommandText

########
set theCommandText to ("/usr/bin/sips --cropToHeightWidth " & numHeight & " " & numWidth & " --cropOffset 480 480 \"" & theImageFilePath & "\" --setProperty format png -o ~/Desktop/cropOffset.png") as text
log "theCommandText:" & theCommandText
do shell script theCommandText

return

|

« [sips]画像の操作 rotate flip horizontal flip vertical | トップページ | [sips]画像のリサンプル resampleHeightWidth resampleHeightWidthMax »

sips」カテゴリの記事