text
stringlengths 0
15.7k
| source
stringlengths 6
112
|
---|---|
transform's translateXBy:((item 1 of item 2 of rotatedBounds) / 2) yBy:((item 2 of item 2 of rotatedBounds) / 2)
|
ImageLib.scpt
|
transform's rotateByDegrees:-degrees
|
ImageLib.scpt
|
transform's translateXBy:((item 1 of item 2 of rotatedBounds) / -2) yBy:((item 2 of item 2 of rotatedBounds) / -2)
|
ImageLib.scpt
|
rotatedImage's lockFocus()
|
ImageLib.scpt
|
theImage's drawInRect:imageBounds fromRect:(current application's CGRectZero) operation:(current application's NSCompositingOperationCopy) fraction:1.0
|
ImageLib.scpt
|
rotatedImage's unlockFocus()
|
ImageLib.scpt
|
set rotatedImageData to rotatedImage's TIFFRepresentation()
|
ImageLib.scpt
|
set my base64data to (rotatedImageData's base64EncodedStringWithOptions:0) as string
|
ImageLib.scpt
|
set my width to current application's NSWidth(rotatedBounds)
|
ImageLib.scpt
|
set my height to current application's NSHeight(rotatedBounds)
|
ImageLib.scpt
|
end rotate
|
ImageLib.scpt
|
on extractText()
|
ImageLib.scpt
|
set requestHandler to current application's VNImageRequestHandler's alloc()'s initWithData:(theImage's TIFFRepresentation()) options:(current application's NSDictionary's alloc()'s init())
|
ImageLib.scpt
|
set textRequest to current application's VNRecognizeTextRequest's alloc()'s init()
|
ImageLib.scpt
|
requestHandler's performRequests:{textRequest} |error|:(missing value)
|
ImageLib.scpt
|
set textResults to textRequest's results()
|
ImageLib.scpt
|
set textItems to {}
|
ImageLib.scpt
|
repeat with observation in textResults
|
ImageLib.scpt
|
copy (first item in (observation's topCandidates:1))'s |string|() as text to end of textItems
|
ImageLib.scpt
|
return textItems
|
ImageLib.scpt
|
end extractText
|
ImageLib.scpt
|
on classifications above confidenceThreshold
|
ImageLib.scpt
|
set classificationRequest to current application's VNClassifyImageRequest's alloc()'s init()
|
ImageLib.scpt
|
requestHandler's performRequests:{classificationRequest} |error|:(missing value)
|
ImageLib.scpt
|
set classificationResults to classificationRequest's results()
|
ImageLib.scpt
|
set classifications to {}
|
ImageLib.scpt
|
repeat with observation in classificationResults
|
ImageLib.scpt
|
if observation's confidence() > confidenceThreshold then
|
ImageLib.scpt
|
copy {identifier:observation's identifier() as text, confidence:observation's confidence() as real} to end of classifications
|
ImageLib.scpt
|
return classifications
|
ImageLib.scpt
|
end classifications
|
ImageLib.scpt
|
on extractPayloads()
|
ImageLib.scpt
|
set barcodeRequest to current application's VNDetectBarcodesRequest's alloc()'s init()
|
ImageLib.scpt
|
requestHandler's performRequests:{barcodeRequest} |error|:(missing value)
|
ImageLib.scpt
|
set barcodeResults to barcodeRequest's results()
|
ImageLib.scpt
|
set payloads to {}
|
ImageLib.scpt
|
repeat with observation in barcodeResults
|
ImageLib.scpt
|
copy (observation's payloadStringValue() as text) to end of payloads
|
ImageLib.scpt
|
return payloads
|
ImageLib.scpt
|
end extractPayloads
|
ImageLib.scpt
|
on countFaces()
|
ImageLib.scpt
|
set faceRequest to current application's VNDetectFaceRectanglesRequest's alloc()'s init()
|
ImageLib.scpt
|
requestHandler's performRequests:{faceRequest} |error|:(missing value)
|
ImageLib.scpt
|
set faceResults to faceRequest's results()
|
ImageLib.scpt
|
return count of faceResults
|
ImageLib.scpt
|
end countFaces
|
ImageLib.scpt
|
on save in filePath : (missing value) as fileType : "png"
|
ImageLib.scpt
|
set theImageData to missing value
|
ImageLib.scpt
|
set theImageData to theImage's TIFFRepresentation()
|
ImageLib.scpt
|
set theBitmap to current application's NSBitmapImageRep's imageRepWithData:theImageData
|
ImageLib.scpt
|
if filePath is missing value then
|
ImageLib.scpt
|
set filePath to my target
|
ImageLib.scpt
|
error "Must provide an output destination."
|
ImageLib.scpt
|
set theType to current application's NSBitmapImageFileTypePNG
|
ImageLib.scpt
|
ignoring case
|
ImageLib.scpt
|
if fileType is "jpg" or fileType is "jpeg" then
|
ImageLib.scpt
|
set theType to current application's NSBitmapImageFileTypeJPEG
|
ImageLib.scpt
|
else if fileType is "gif" then
|
ImageLib.scpt
|
set theType to current application's NSBitmapImageFileTypeGIF
|
ImageLib.scpt
|
else if fileType is "bmp" then
|
ImageLib.scpt
|
set theType to current application's NSBitmapImageFileTypeBMP
|
ImageLib.scpt
|
else if fileType is "tiff" then
|
ImageLib.scpt
|
set theType to current application's NSBitmapImageFileTypeTIFF
|
ImageLib.scpt
|
end ignoring
|
ImageLib.scpt
|
set theData to theBitmap's representationUsingType:theType |properties|:(missing value)
|
ImageLib.scpt
|
set theURL to current application's |NSURL|'s fileURLWithPath:filePath
|
ImageLib.scpt
|
theData's writeToURL:theURL atomically:true
|
ImageLib.scpt
|
end save
|
ImageLib.scpt
|
on open
|
ImageLib.scpt
|
set theData to theBitmap's representationUsingType:(current application's NSBitmapImageFileTypePNG) |properties|:(missing value)
|
ImageLib.scpt
|
set theTempFile to POSIX path of (current application's NSTemporaryDirectory() as string) & "Image.png"
|
ImageLib.scpt
|
set theURL to current application's |NSURL|'s fileURLWithPath:theTempFile
|
ImageLib.scpt
|
set theWorkspace to current application's NSWorkspace's sharedWorkspace()
|
ImageLib.scpt
|
theWorkspace's openURL:theURL
|
ImageLib.scpt
|
set theImage to ILImage's _getNSImage()
|
ImageLib.scpt
|
if theImage is not missing value then
|
ImageLib.scpt
|
set ILImage's base64data to (theImage's TIFFRepresentation()'s base64EncodedStringWithOptions:0) as string
|
ImageLib.scpt
|
set ILImage's width to theImage's |size|()'s width()
|
ImageLib.scpt
|
set ILImage's height to theImage's |size|()'s height()
|
ImageLib.scpt
|
return ILImage
|
ImageLib.scpt
|
end Image
|
ImageLib.scpt
|
on extractText from theImage
|
ImageLib.scpt
|
return theImage's extractText()
|
ImageLib.scpt
|
on classifications for theImage above confidenceLevel
|
ImageLib.scpt
|
return theImage's (classifications above confidenceLevel)
|
ImageLib.scpt
|
on extractPayloads from theImage
|
ImageLib.scpt
|
return theImage's extractPayloads()
|
ImageLib.scpt
|
on Symbol(symbolName, pointSize)
|
ImageLib.scpt
|
set imageObj to Image("---")
|
ImageLib.scpt
|
set theConfig to current application's NSImageSymbolConfiguration's configurationWithPointSize:pointSize weight:(current application's NSFontWeightRegular)
|
ImageLib.scpt
|
set theImage to current application's NSImage's imageWithSystemSymbolName:symbolName accessibilityDescription:(missing value)
|
ImageLib.scpt
|
set theImage to theImage's imageWithSymbolConfiguration:theConfig
|
ImageLib.scpt
|
set imageObj's base64data to (theImage's TIFFRepresentation()'s base64EncodedStringWithOptions:0) as string
|
ImageLib.scpt
|
set imageObj's width to theImage's |size|()'s width()
|
ImageLib.scpt
|
set imageObj's height to theImage's |size|()'s height()
|
ImageLib.scpt
|
set imageObj's modified to true
|
ImageLib.scpt
|
return imageObj
|
ImageLib.scpt
|
end Symbol
|
ImageLib.scpt
|
on createImage from theData
|
ImageLib.scpt
|
if theData is missing value then
|
ImageLib.scpt
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.