base classes — bpy_struct, ID

class bpy.types.Image(ID)

Image data-block referencing an external or packed image


Representation of alpha in the image file, to convert to and from when saving and loading the image

  • STRAIGHT Straight, Store RGB and alpha channels separately with alpha acting as a mask, also known as unassociated alpha. Commonly used by image editing applications and file formats like PNG.
  • PREMUL Premultiplied, Store RGB channels with alpha multipled in, also known as associated alpha. The natural format for renders and used by file formats like OpenEXR.
  • CHANNEL_PACKED Channel Packed, Different images are packed in the RGB and alpha channels, and they should not affect each other. Channel packing is commonly used by game engines to save memory.
  • NONE None, Ignore alpha channel from the file and make image fully opaque.
Type:enum in [‘STRAIGHT’, ‘PREMUL’, ‘CHANNEL_PACKED’, ‘NONE’], default ‘STRAIGHT’

OpenGL bindcode

Type:int in [0, inf], default 0, (readonly)

Number of channels in pixels buffer

Type:int in [0, inf], default 0, (readonly)

Input color space settings

Type:ColorManagedInputColorspaceSettings, (readonly)

Image bit depth

Type:int in [0, inf], default 0, (readonly)

Display Aspect for this image, does not affect rendering

Type:float array of 2 items in [0.1, inf], default (0.0, 0.0)

Format used for re-saving this file

  • BMP BMP, Output image in bitmap format.
  • IRIS Iris, Output image in (old!) SGI IRIS format.
  • PNG PNG, Output image in PNG format.
  • JPEG JPEG, Output image in JPEG format.
  • JPEG2000 JPEG 2000, Output image in JPEG 2000 format.
  • TARGA Targa, Output image in Targa format.
  • TARGA_RAW Targa Raw, Output image in uncompressed Targa format.
  • CINEON Cineon, Output image in Cineon format.
  • DPX DPX, Output image in DPX format.
  • OPEN_EXR_MULTILAYER OpenEXR MultiLayer, Output image in multilayer OpenEXR format.
  • OPEN_EXR OpenEXR, Output image in OpenEXR format.
  • HDR Radiance HDR, Output image in Radiance HDR format.
  • TIFF TIFF, Output image in TIFF format.
  • AVI_JPEG AVI JPEG, Output video in AVI JPEG format.
  • AVI_RAW AVI Raw, Output video in AVI Raw format.
  • FFMPEG FFmpeg video, The most versatile way to output video files.
Type:enum in [‘BMP’, ‘IRIS’, ‘PNG’, ‘JPEG’, ‘JPEG2000’, ‘TARGA’, ‘TARGA_RAW’, ‘CINEON’, ‘DPX’, ‘OPEN_EXR_MULTILAYER’, ‘OPEN_EXR’, ‘HDR’, ‘TIFF’, ‘AVI_JPEG’, ‘AVI_RAW’, ‘FFMPEG’], default ‘TARGA’

Image/Movie file name

Type:string, default “”, (never None)

Image/Movie file name (without data refreshing)

Type:string, default “”, (never None)

Duration (in frames) of the image (1 when not a video/sequence)

Type:int in [0, inf], default 0, (readonly)

Fill color for the generated image

Type:float array of 4 items in [0, inf], default (0.0, 0.0, 0.0, 0.0)

Generated image height

Type:int in [1, 65536], default 0

Generated image type

  • BLANK Blank, Generate a blank image.
  • UV_GRID UV Grid, Generated grid to test UV mappings.
  • COLOR_GRID Color Grid, Generated improved UV grid to test UV mappings.
Type:enum in [‘BLANK’, ‘UV_GRID’, ‘COLOR_GRID’], default ‘BLANK’

Generated image width

Type:int in [1, 65536], default 0

True if the image data is loaded into memory

Type:boolean, default False, (readonly)

Image has changed and is not saved

Type:boolean, default False, (readonly)

True if this image is stored in float buffer

Type:boolean, default False, (readonly)

Image has more than one view

Type:boolean, default False, (readonly)

Image has left and right views

Type:boolean, default False, (readonly)

First packed file of the image

Type:PackedFile, (readonly)

Collection of packed images

Type:bpy_prop_collection of ImagePackedFile, (readonly)

Image pixels in floating point values

Type:float in [-inf, inf], default 0.0

Render slots of the image

Type:RenderSlots bpy_prop_collection of RenderSlot, (readonly)

X/Y pixels per meter

Type:float array of 2 items in [-inf, inf], default (0.0, 0.0)

Width and height in pixels, zero when image data cant be loaded

Type:int array of 2 items in [-inf, inf], default (0, 0), (readonly)

Where the image comes from

  • FILE Single Image, Single image file.
  • SEQUENCE Image Sequence, Multiple image files, as a sequence.
  • MOVIE Movie, Movie file.
  • GENERATED Generated, Generated image.
  • VIEWER Viewer, Compositing node viewer.
Type:enum in [‘FILE’, ‘SEQUENCE’, ‘MOVIE’, ‘GENERATED’, ‘VIEWER’], default ‘FILE’

Settings for stereo 3d

Type:Stereo3dFormat, (readonly, never None)

How to generate the image

Type:enum in [‘IMAGE’, ‘MULTILAYER’, ‘UV_TEST’, ‘RENDER_RESULT’, ‘COMPOSITING’], default ‘IMAGE’, (readonly)

Deinterlace movie file on load

Type:boolean, default False

Generate floating point buffer

Type:boolean, default False

Use Multiple Views (when available)

Type:boolean, default False

Apply render part of display transformation when displaying this image on the screen

Type:boolean, default False

Mode to load image views

  • INDIVIDUAL Individual, Individual files for each view with the prefix as defined by the scene views.
  • STEREO_3D Stereo 3D, Single file with an encoded stereo pair.
Type:enum in [‘INDIVIDUAL’, ‘STEREO_3D’], default ‘INDIVIDUAL’
save_render(filepath, scene=None)

Save image to a specific path using a scenes render settings

  • filepath (string, (never None)) – Save path
  • scene (Scene, (optional)) – Scene to take image parameters from

Save image to its source path

pack(data="", data_len=0)

Pack an image as embedded data into the .blend file

  • data (string, (optional, never None)) – data, Raw data (bytes, exact content of the embedded file)
  • data_len (int in [0, inf], (optional)) – data_len, length of given data (mandatory if data is provided)

Save an image packed in the .blend file to disk

Parameters:method (enum in ['USE_LOCAL', 'WRITE_LOCAL', 'USE_ORIGINAL', 'WRITE_ORIGINAL'], (optional)) – method, How to unpack

Reload the image from its source path


Update the display image from the floating point buffer

scale(width, height)

Scale the image in pixels

  • width (int in [1, 10000]) – Width
  • height (int in [1, 10000]) – Height

Delay the image from being cleaned from the cache due inactivity

Parameters:frame (int in [0, inf], (optional)) – Frame, Frame of image sequence or movie
Returns:Error, OpenGL error value
Return type:int in [-inf, inf]

Load the image into an OpenGL texture. On success, image.bindcode will contain the OpenGL texture bindcode. Colors read from the texture will be in scene linear color space and have premultiplied alpha.

Parameters:frame (int in [0, inf], (optional)) – Frame, Frame of image sequence or movie
Returns:Error, OpenGL error value
Return type:int in [-inf, inf]

Free the image from OpenGL graphics memory


Return the absolute path to the filepath of an image frame specified by the image user

Parameters:image_user (ImageUser, (optional)) – Image user of the image to get filepath for
Returns:File Path, The resulting filepath from the image and it’s user
Return type:string, (never None)

Free the image buffers from memory

classmethod bl_rna_get_subclass(id, default=None)
Parameters:id (string) – The RNA type identifier.
Returns:The RNA type or default when not found.
Return type:bpy.types.Struct subclass
classmethod bl_rna_get_subclass_py(id, default=None)
Parameters:id (string) – The RNA type identifier.
Returns:The class or default when not found.
Return type:type

Inherited Properties

Inherited Functions