Beispiel #1
0
def create_movie_from_images(image_file_names, frames_per_second, width=None, height=None):
    """image_file_names should be a list of images whose length is at least 1.
    Returns the path to the created movie or None on failure.

    Note: width must be integer multiple of 4.  This is is a limitation of the RAW RGB AVI format.
    """
    image_encoding, error_message = image_helper.get_image_encoding_from_file_names(image_file_names)
    if image_encoding == image_helper.ImageEncoding.unknown:
        return

    return _create_movie_from_images_with_image_encoding(image_file_names, frames_per_second, image_encoding, width, height)
    def select_images(self):
        """Bring up a dialog to allow the user to select one or more images.
        Return a list of the selected image file names.
        """
        files = tkinter.filedialog.askopenfilenames(
            parent=self.window,
            title="Select Images",
            filetypes=[("Image", ".jpg"), ("Image", ".jpeg"), ("Image", ".png"), ("All Files", ".*")])
        if not files:
            return
        logger.debug("File picker returned \n{}.".format(pprint.pformat(files)))

        image_file_names = self.get_image_file_names(files)
        logger.debug("Settings images to \n{}".format(pprint.pformat(image_file_names)))

        self.set_status_label('')

        encoding, error_message = image_helper.get_image_encoding_from_file_names(image_file_names)
        if encoding == image_helper.ImageEncoding.unknown:
            self.user_message(error_message)
            image_file_names = []

        self.set_images(image_file_names)