This repository has been archived by the owner on Mar 4, 2023. It is now read-only.
/
Image.py
83 lines (68 loc) · 2.77 KB
/
Image.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
class Image:
"""The Image object is used to store color values and attributes associated with a raster
file. Upon creation, the Image object is added to the session.images repository.
Notes
-----
This object can be accessed by:
.. code-block:: python
session.images[name]
"""
def __init__(self, name: str, fileName: str):
"""This method creates an Image object from the contents of the specified file.
Notes
-----
This function can be accessed by:
.. code-block:: python
session.Image
Parameters
----------
name
A String specifying the repository name for the image.
fileName
A String specifying the file from which the image is to be read. The file extension must
be specified and indicate the image format (.bmp, .gif, .jpg, .jpeg, .ico, .pcx, .png,
.rgb, .tga, .tif, or .xpm).
Returns
-------
An Image object.
Raises
------
ValueError.
- If *fileName* does not exist or can not be read:
ValueError: Unable to open image file
- If *fileName* references an unsupported image file format:
ValueError: Unsupported image format
- If the contents of *fileName* are corrupt or can not be decoded:
ValueError: Unable to decode image file
"""
pass
def ImageFromMovie(self, name: str, movieName: str, frame: int, time: float):
"""This method creates an Image object from a given frame of an existing Movie object.
Parameters
----------
name
A String specifying the repository name for the image.
movieName
A String specifying the name of the movie from which the image is to be extracted. The
movie must exist in the session.movies repository.
frame
An Int specifying the movie frame number defining the image to be extracted.
time
A Float specifying the time of the movie defining the image to be extracted.
Returns
-------
An Image object.
Raises
------
ValueError.
TypeError.
- If *movieName* does not exist:
ValueError: There is no movie object with this name: 'movieName'
- If *frame* references an non existing frame:
ValueError: Could not load frame n from movie: 'movieName'
- If *time* references an non existing frame:
ValueError: Could not load frame at time 't' from movie: 'movieName'
- If *time* and *frame* are given in the same command:
TypeError: keyword error on time
"""
pass