Is possible to capture images dynamically in sikuli? - python

I am using sikuli to load IE and from that i am opening the .flv records from adobe connect.In that i have capture images dynamically and have to store that images in a list object or any data structure. Is it possible to capture images from a window dynamically in sikuli?
Please help me.
Thanks.

def CaptureScreen(path):
#Take Screen shot and move it from temp folder to new location <path>
shutil.move(capture(Screen()), path)
http://doc.sikuli.org/screen.html#Screen.capture
http://www.jython.org/docs/library/shutil.html

Related

Take a screen shot of a specif area and save as variable

I want to make a program taking a cropped screenshot (like Windows+Shift+s) and save it as variable, not as a file.
How do I Programmatically open this win+shift+s window?
How to directly get the output without saving this as a picture?
I'm using python
you will need to:
trigger the Print screen key (any keyboard library should allow it)
retrieve the data from the clipboard (you will maybe forced to save it as a temporary file and then read from it)
then parse the data it will be it will png format.

Removing formatted images from a word document using Python

I have a word document from a colleague who gave me a .docx Microsoft Word file with 90 images on it that need to be extracted so they can be turned into flashcards. I tried using the Python module "docx2txt" which worked ok, but only extracted 34 images. Upon further inspection, I found that it was because when my coworker made the original file, he took screenshots of PowerPoint slides that he had made with about 4-6 of the images on one slide. Then, he would put them in Word and use the built in Word trimming tool to copy the picture several times and trim down to each individual picture he needed in a particular line of the document. Docx2txt copied the pictures files to my designated directly perfectly, but did not keep the formatting. Any picture file he had inserted and "trimmed down" to size, was copied as the full image. Does anyone know of a way to keep the formatting so I don't have to go through and manually copy 90 pictures one by one? Perhaps converting to a .pdf file and using a pdf related module or something? Or might be there some way of using another Python library which will keep the picture formatting? Thanks for any help you can provide! I'm somewhat of a beginner with Python, but love it when I can get it to automate stuff... even if it ends up taking longer to figure out how to do it than just boring myself to death saving the photos manually, lol.
https://support.microsoft.com/en-us/topic/reduce-the-file-size-of-a-picture-in-microsoft-office-8db7211c-d958-457c-babd-194109eb9535
Important: Cropped parts of the picture are not removed from the file, and can potentially be seen by others; including search engines if the cropped image is posted online. Only the Office desktop apps have the ability to remove cropped areas from the underlying image file.
Follow the relevant section for Desktop Office (Windows or Mac) note from above it CANNOT work on Web 365.
go to "Other kinds of cropping"
Important: If you delete cropped areas and later change your mind, you can click the Undo Button Image button to restore them. Deletions can [ONLY] be undone until the file is saved.
So make a backup copy of the file
Select the picture or pictures (If you want all selected that should be easy with CTRL + A to highlight everything)
Then follow the instructions
Picture Tools > Format, and in the Adjust group, click Compress Pictures
Be sure that the Delete cropped areas of pictures check box is selected
DEselect the Apply only to this picture check box.
Double check a few manually to verify all is well then save a copy.

How to load image using pygame.image.load()?

I just want to know the syntax. How do I load an image using pygame.image.load() ?
Let's take an example, I want to load an image called cat.png - and type this
pygame.image.load('cat.png')
Then, where should the image cat.png be saved?
By default, Python only searches in your current directory for files, however, if you wish to load images from a separate directory, you may find this useful:
Importing images from a directory (Python)
For the syntax, I reccomend you refer to the documentation, here:
https://www.pygame.org/docs/ref/image.html#pygame.image.load
pygame.image.load()ΒΆ
load new image from a file
load(filename) -> Surface
load(fileobj, namehint="") -> Surface
Load an image from a file source. You can pass either a filename or a Python file-like object.
Any images loaded directly with
pygame.image.load('Image Name')
should be saved in the same folder as the python script that is using the image

Display jpeg address as actual images

Current IDE: Anaconda using App: Spyder.
I wrote a program to data scrape a website and filter posts by keywords.
This is the output.
What is the best way to display a list of images given jpeg addresses?
A few attempts include:
Using Pillows - but the best I can do is open a new tab with Google Chrome to display the photo.
Using Image - but I can only open in Preview saved images on my computer.
Using csv - only to export the output as a neatly formatted csv file.
Try to use some regex pattern to match all these cases.
import re
if re.search(r'^.*\.jpeg$', full_url):
# do something

Python upload an Image form my hard drive and show it on a canvas wideget.

I am writing a small python program that upload an image from A SPECIFIC location in my computer and then show it on a canvas wideget. I am using Tkinter as a GUI.
Problem: I need to upload the image from any location in my computer. I need to create a window explorer (similar to the one windows has Ctr + O) that let you browse through your folders to find the image you want to upload.
Question: What is the best way or module to create the Open Window explorer.
Thanks
There's a handy module for that: tkFileDialog!
import tkFileDialog
tkFileDialog.askopenfilename()
The function will return the path to the file for you and theres a variety of options you can set here

Categories

Resources