Loading a jpeg image (Python)¶
Loading a jpeg image (Python)¶
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
9fileName = "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( fileName, embed, None )
15
16# clear the output toolbox
17impact.gui.output_toolbox.clear()
18
19# determine if the image was loaded successfully
20if not image.isNone():
21 impact.gui.output_toolbox.add("successfully loaded " + fileName)
22else:
23 impact.gui.output_toolbox.add("failed to load " + fileName)