2014-09-25 3 views
0

나는 Sikuli IDE로 스크린 샷을 찍는 방법을 안다. 현재 sikuli_cpython을 사용 중입니다. 나는 같은 것을하려고 노력하고있다 :sikuli_cpython을 사용하여 screnshot을 얻는 방법은 무엇입니까?

import sikuli 
my_screen = sikuli.DesktopScreenRegion() 
my_capture = my_screen.capture() 

print my_capture 
<java.awt.image.BufferedImage at 0x66ef7b0 jclass=java/awt/image/BufferedImage jself=<LocalRef obj=0xbe79688 at 0x62fda00>> 

그것이 스크린 샷을 저장하는 방법을 모르는 곳이다.

dir(my_capture) 
'BITMASK', 'OPAQUE', 'SCALE_AREA_AVERAGING', 'SCALE_DEFAULT', 'SCALE_FAST', 
'SCALE_REPLICATE', 'SCALE_SMOOTH', 'TRANSLUCENT', 'TYPE_3BYTE_BGR',  
'TYPE_4BYTE_ABGR', 'TYPE_4BYTE_ABGR_PRE', 'TYPE_BYTE_BINARY', 'TYPE_BYTE_GRAY', 
'TYPE_BYTE_INDEXED', 'TYPE_CUSTOM', 'TYPE_INT_ARGB', 'TYPE_INT_ARGB_PRE',  
'TYPE_INT_BGR', 'TYPE_INT_RGB', 'TYPE_USHORT_555_RGB', 'TYPE_USHORT_565_RGB', 
'TYPE_USHORT_GRAY', 'UndefinedProperty', '__class__', '__cls_storage', '__delattr__', 
'__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', 
'__javaclass__', '__javaconstructor__', '__module__', '__new__', '__pyx_vtable__', 
'__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', 
'__subclasshook__', '__weakref__', 'addTileObserver', 'coerceData', 'copyData', 
'createGraphics', 'equals', 'flush', 'getAccelerationPriority', 'getAlphaRaster', 
'getCapabilities', 'getClass', 'getColorModel', 'getData', 'getGraphics', 'getHeight', 
'getMinTileX', 'getMinTileY', 'getMinX', 'getMinY', 'getNumXTiles', 'getNumYTiles', 
'getProperty', 'getPropertyNames', 'getRGB', 'getRaster', 'getSampleModel', 
'getScaledInstance', 'getSource', 'getSources', 'getSubimage', 'getTile', 
'getTileGridXOffset', 'getTileGridYOffset', 'getTileHeight', 'getTileWidth', 
'getTransparency', 'getType', 'getWidth', 'getWritableTile', 'getWritableTileIndices', 
'hasTileWriters', 'hashCode', 'isAlphaPremultiplied', 'isTileWritable', 'notify', 
'notifyAll', 'releaseWritableTile', 'removeTileObserver', 'setAccelerationPriority', 
'setData', 'setRGB', 'toString', 'wait'] 
+0

dir (my_capture)의 결과를 보여줄 수 있습니까? –

+0

sikuli_script.py는 내가 언급 한 코드가 포함 된 스크립트입니다. – GiannisIordanou

+0

아니요. my_capture의 속성을 확인하는 것을 의미합니다. dir()은 파이썬의 내장 함수입니다. –

답변

0

사용하여 다음 (sikuli이 문서에 같은 와일드 카드로 가져온 가정) :

img = Screen().capture() 
filePath = os.path.join(r"c:\path\to\place\image", "imageOutput.png") 
shutil.move(img, filePath) 
print "File is now locatede at %s" % filePath 

당신은 지금까지의 이미지를 가지고 있지만, 당신은 다음 위치에서 이미지를 이동해야하는 것이 선택한 위치에 저장되었습니다.