Loading a jpeg image¶
Loading a jpeg image¶
1# this example loads a jpeg image, since the image is a jpeg
2# None is passed as the PostScriptImageOptions method parameter
3# in the IGraphicImages.load_from_file() method
4
5# get the images collection from the active drawing
6images = impact.active_drawing.graphic_images
7
8# define some local variables
9file_name = "d:\1.jpg"
10embed = 0
11
12# call the IGraphicImages.load_from_file() method to load the image
13# into the drawing
14image = images.load_from_file(file_name, embed, None)
15
16# clear the output toolbox
17impact.gui.output_toolbox.clear()
18
19# determine if the image was loaded successfully
20if image is not None:
21 impact.gui.output_toolbox.add("successfully loaded " + str(file_name))
22else:
23 impact.gui.output_toolbox.add("failed to load " + str(file_name))
24
25
26
27
28
29
30
31