OpenShot Video Editor  2.0.0
thumbnail.py
Go to the documentation of this file.
1 ##
2 #
3 # @file
4 # @brief This file has code to generate thumbnail images
5 # @author Jonathan Thomas <jonathan@openshot.org>
6 #
7 # @section LICENSE
8 #
9 # Copyright (c) 2008-2018 OpenShot Studios, LLC
10 # (http://www.openshotstudios.com). This file is part of
11 # OpenShot Video Editor (http://www.openshot.org), an open-source project
12 # dedicated to delivering high quality video editing and animation solutions
13 # to the world.
14 #
15 # OpenShot Video Editor is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU General Public License as published by
17 # the Free Software Foundation, either version 3 of the License, or
18 # (at your option) any later version.
19 #
20 # OpenShot Video Editor is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
24 #
25 # You should have received a copy of the GNU General Public License
26 # along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
27 #
28 
29 
30 import openshot
31 
32 
33 ##
34 # Create thumbnail image, and check for rotate metadata (if any)
35 def GenerateThumbnail(file_path, thumb_path, thumbnail_frame, width, height, mask, overlay):
36 
37  # Craete a clip object and get the reader
38  clip = openshot.Clip(file_path)
39  reader = clip.Reader()
40 
41  # Open reader
42  reader.Open()
43 
44  # Get the 'rotate' metadata (if any)
45  rotate = 0.0
46  try:
47  if reader.info.metadata.count("rotate"):
48  rotate = float(reader.info.metadata.find("rotate").value()[1])
49  except:
50  pass
51 
52  # Save thumbnail image and close readers
53  reader.GetFrame(thumbnail_frame).Thumbnail(thumb_path, width, height, mask, overlay, "#000", False, "png", 100, rotate)
54  reader.Close()
55  clip.Close()
def GenerateThumbnail(file_path, thumb_path, thumbnail_frame, width, height, mask, overlay)
Create thumbnail image, and check for rotate metadata (if any)
Definition: thumbnail.py:35