The image object

An image object returns information about an image. Image objects are usually attributes of other objects, such as product, variant, collection, and article.

The image object has the following attributes:


Returns the alt tag of the image, set in the Products page of the Admin.


Returns the aspect ratio (width / height) of the image.


Returns true if the image has been associated with a variant. Returns false otherwise. This can be used in cases where you want to create a gallery of images that are not associated with variants.


Returns the height of the image in pixels.

Returns the ID of the image.


Returns the type of the object (image).

The media_type property can be used to filter the array for all media of a desired type.


Returns the position of the image in the product object's media array.


Returns a preview image for the image.


Returns the id of the image's product.


Returns the relative path of the product image. This is the same as outputting {{ image }}.

To return the URL of the image on Shopify's Content Delivery Network (CDN), use the appropriate URL filter.

To see a full list of available image sizes, see image size parameters.

Shown below is an example of loading a product image using the image_url filter.


Returns an array of attributes for the variant that the image is associated with.


Returns the width of the image in pixels.