ImageEntity
A flat image placed in 3D space, used for reference photos, decals, or texture previews.
Images in SketchUp are rectangular planes that display bitmap data (PNG, JPG, etc.) at a specific position and orientation. They’re not geometry — they don’t create faces — but they can be queried, transformed, and exported. Images are often used as modeling references (like blueprints) or for visual context (like site photos).
Each image has both a pixel resolution (imageWidth × imageHeight) and a
physical size (width × height in inches). The physical size determines
how large it appears in the model, while the pixel dimensions control the
visual fidelity.
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();
// Create a small 2x2 canvas with a gradient.let canvas = document.createElement('canvas');canvas.width = 2;canvas.height = 2;let ctx = canvas.getContext('2d');let grad = ctx.createLinearGradient(0, 0, 2, 2);grad.addColorStop(0, '#ff0000');grad.addColorStop(1, '#0000ff');ctx.fillStyle = grad;ctx.fillRect(0, 0, 2, 2);
// Place it in the model as a 50" wide image.let dataUrl = canvas.toDataURL();await model.performOperation(op => { op.createImage(model, { resource: { dataUrl }, origin: [0, 0, 0], width: 50, });}, 'Place gradient image');
// Query the image back and read its properties.let images = await model.entities.get({ filterBy: { types: ['Image'] }});let img = images[0];console.log(img.width, img.height);// => 50 50 (physical size in inches)console.log(img.imageWidth, img.imageHeight);// => 2 2 (pixel resolution)console.log(img.origin.toArray());// => [0, 0, 0]console.log(img.normal.toArray());// => [0, 0, 1]SDK 2.21.0 Protocol 1.19.0
Extends
Section titled “Extends”BaseDrawingElement
Properties
Section titled “Properties”attributes
Section titled “attributes”
readonlyattributes:Attributes
The attribute dictionaries attached to this element. Attributes store custom key-value metadata that extensions can read and write.
Inherited from
Section titled “Inherited from”BaseDrawingElement.attributes
castsShadows
Section titled “castsShadows”
readonlycastsShadows:boolean
Whether this element casts shadows onto other geometry.
Inherited from
Section titled “Inherited from”BaseDrawingElement.castsShadows
fileName
Section titled “fileName”
readonlyfileName:string
The original filename of the image when it was imported, like “blueprint.png”. This may be a generated name if the image was created from raw data.
gluedToId
Section titled “gluedToId”
readonlygluedToId:SketchupId|undefined
The ID of the face this image is glued to, if any. Glued images move with
the face and inherit its orientation. Returns undefined if the image is
free-standing.
height
Section titled “height”
readonlyheight:number
The physical height of the image as it appears in the model, measured in inches. This is independent of the pixel resolution — a 10-pixel-tall image can be displayed at 100 inches tall.
hidden
Section titled “hidden”
readonlyhidden:boolean
Whether this element is hidden. Hidden elements don’t appear in the viewport unless the user enables “View > Hidden Geometry.”
Inherited from
Section titled “Inherited from”BaseDrawingElement.hidden
readonlyid:number
The persistent ID that uniquely identifies this image.
imageHeight
Section titled “imageHeight”
readonlyimageHeight:number
The height of the underlying bitmap in pixels.
imageWidth
Section titled “imageWidth”
readonlyimageWidth:number
The width of the underlying bitmap in pixels.
materialRef
Section titled “materialRef”
readonlymaterialRef:MaterialRef|undefined
A reference to the material applied to this element, if any. Call
getMaterial() to fetch the full Material object with color and texture data.
Inherited from
Section titled “Inherited from”BaseDrawingElement.materialRef
receivesShadows
Section titled “receivesShadows”
readonlyreceivesShadows:boolean
Whether this element receives shadows cast by other geometry.
Inherited from
Section titled “Inherited from”BaseDrawingElement.receivesShadows
tagRef
Section titled “tagRef”
readonlytagRef:TagRef|undefined
A reference to the tag (formerly “layer”) assigned to this element. Call
getTag() to fetch the full Tag object.
Inherited from
Section titled “Inherited from”BaseDrawingElement.tagRef
transform
Section titled “transform”
readonlytransform:Transformation
The transformation matrix that positions and orients this image in 3D space. The origin is the image’s lower-left corner, and the Z-axis points out from the image plane.
readonlytype:Image=EntityType.Image
readonlywidth:number
The physical width of the image as it appears in the model, measured in inches. This is independent of the pixel resolution — a 10-pixel-wide image can be displayed at 100 inches wide.
Accessors
Section titled “Accessors”normal
Section titled “normal”Get Signature
Section titled “Get Signature”get normal():
Vector3d
The direction the image faces — a unit vector perpendicular to the image
plane. This is a convenience accessor for transform.zaxis. If the image
is glued to a face, the normal will match the face’s orientation.
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let images = await model.entities.get({ filterBy: { types: ['Image'] }});console.log(images[0].normal.toArray());// => [0, 0, 1] (facing up along the Z-axis)Returns
Section titled “Returns”origin
Section titled “origin”Get Signature
Section titled “Get Signature”get origin():
Point3d
The position of the image’s lower-left corner in 3D space. This is a
convenience accessor for transform.origin.
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let images = await model.entities.get({ filterBy: { types: ['Image'] }});console.log(images[0].origin.toArray());// => [120, 0, 0]Returns
Section titled “Returns”sketchupId
Section titled “sketchupId”Get Signature
Section titled “Get Signature”get sketchupId():
SketchupId
JS API identifier for this image. Pass it to API methods that accept a sketchupId.
Returns
Section titled “Returns”Overrides
Section titled “Overrides”BaseDrawingElement.sketchupId
typeName
Section titled “typeName”Get Signature
Section titled “Get Signature”get typeName():
string
Returns a named variant of the type field.
SDK 2.35.0
Returns
Section titled “Returns”string
zrotation
Section titled “zrotation”Get Signature
Section titled “Get Signature”get zrotation():
number
The rotation angle of the image around its normal vector, measured in
radians. Zero means the image’s X-axis aligns with the world X-axis
(assuming the normal is [0, 0, 1]). This is a convenience accessor for
transform.zrotation.
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let images = await model.entities.get({ filterBy: { types: ['Image'] }});let degrees = images[0].zrotation * (180 / Math.PI);console.log(degrees);// => 45.0 (rotated 45 degrees)Returns
Section titled “Returns”number
Methods
Section titled “Methods”export()
Section titled “export()”export(
fileType):Promise<string>
Exports the image’s bitmap data as a base64-encoded string in the specified
format. Use this to extract the underlying texture for saving to disk or
displaying in a web page. The returned string is raw base64 — prepend a
data URL prefix like data:image/png;base64, if needed for HTML.
Note that GIF export is not supported in the web version of SketchUp due to browser limitations.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
|
|
|
The file type that the data should be encoded as
(e.g., “png”, “jpg”, “bmp”). Pass an |
Returns
Section titled “Returns”Promise<string>
A promise containing the base64-encoded image data.
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let images = await model.entities.get({ filterBy: { types: ['Image'] }});let base64 = await images[0].export('png');console.log(base64.substring(0, 20));// => iVBORw0KGgoAAAANSUhE...getBounds()
Section titled “getBounds()”getBounds():
Promise<BoundingBox>
Fetches the axis-aligned bounding box for this element from SketchUp.
Returns
Section titled “Returns”Promise<BoundingBox>
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let all = await model.entities.get();let element = all[0];let box = await element.getBounds();console.log(box.min.x, box.min.y, box.min.z);console.log(box.max.x, box.max.y, box.max.z);SDK 2.30.0
Inherited from
Section titled “Inherited from”BaseDrawingElement.getBounds
getMaterial()
Section titled “getMaterial()”getMaterial():
Promise<Material|undefined>
Fetches the material applied to this element. Returns undefined if the
element uses the default material.
Returns
Section titled “Returns”Promise<Material | undefined>
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let all = await model.entities.get();let element = all[0];let mat = await element.getMaterial();if (mat) { console.log(mat.name, mat.color.toHex());}SDK 2.30.0
Inherited from
Section titled “Inherited from”BaseDrawingElement.getMaterial
getTag()
Section titled “getTag()”getTag():
Promise<Tag|undefined>
Fetches the tag assigned to this element. Most elements have a tag — even
those on the default “Untagged” tag. Returns undefined only if the tag
reference is missing.
Returns
Section titled “Returns”Promise<Tag | undefined>
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let all = await model.entities.get();let element = all[0];let tag = await element.getTag();if (tag) { console.log(tag.name);}SDK 2.30.0
Inherited from
Section titled “Inherited from”BaseDrawingElement.getTag
refresh()
Section titled “refresh()”refresh():
Promise<ImageEntity>
Re-fetches this image from SketchUp to get its current state. Because
ImageEntity is a snapshot, it can become stale if the model changes (e.g.,
if the user moves or resizes the image). Call refresh() to get an
up-to-date copy.
Returns
Section titled “Returns”Promise<ImageEntity>
A new ImageEntity reflecting the current model state. Throws if the image has been deleted.
Example
Section titled “Example”let model = await SketchUpApi.getActiveModel();let images = await model.entities.get({ filterBy: { types: ['Image'] }});// Later, after the user makes changes...let fresh = await images[0].refresh();console.log(fresh.width, fresh.height);toString()
Section titled “toString()”toString():
string
Returns a string representation of an object.
Returns
Section titled “Returns”string
Deprecated
Section titled “Deprecated”materialId
Section titled “materialId”
readonlymaterialId:number|undefined
Inherited from
Section titled “Inherited from”BaseDrawingElement.materialId
readonlytagId:number|undefined
Inherited from
Section titled “Inherited from”BaseDrawingElement.tagId
bounds
Section titled “bounds”Get Signature
Section titled “Get Signature”get bounds():
Promise<BoundingBox>
Returns
Section titled “Returns”Promise<BoundingBox>
Inherited from
Section titled “Inherited from”BaseDrawingElement.bounds
Get Signature
Section titled “Get Signature”get tag():
Promise<Readonly<Tag> |undefined>
Returns
Section titled “Returns”Promise<Readonly<Tag> | undefined>
Inherited from
Section titled “Inherited from”BaseDrawingElement.tag