Skip to content

Image Stimulus

An image stimulus displays an image

Required Properties

type

  • Definition: The type of stimulus
  • Possible values: For image stimuli, must be specified as "image"
{
  "type": "image",
  "content": "image1.jpg"
}

content

  • Definition: A pointer to the underlying resource
  • Possible values: Must be the file name of the image file (you will be prompted to upload the image file)
  • Format support is dependent upon the participant's browser. See Tips tab for further information.
{
  "type": "image",
  "content": "image1.jpg"
}
  • Common image formats such as .jpg, .png, and .gif are safe choices for the majority of cases.

Optional Properties

barrier

  • Definition: If set to 'true', a duration property must also be specified, and the stimulus will prevent all other subsequent stimuli and responses from appearing on the trial until the specified duration is over.
  • Possible values: true or false
  • Default: false

{
  "type": "image",
  "content": "fixation_cross.png",
  "barrier": true,
  "duration": 1
}
In trials using the above stimulus code, the image "fixation_cross.png" will be displayed before other stimuli and responses are displayed.

delay

Info

This property is used for presenting multiple stimuli on a trial in a sequence. To implement inter-trial intervals, see the delay parameter in trial templates instead.

Warning

The delaying of multiple stimuli on a trial does NOT have a chain effect. That is, the delay of any stimulus on a trial is always relative to the onset of that trial or the end of the last stimulus acting as a barrier.

  • Definition: Delay the onset of a stimulus by a certain number of seconds, relative to (1) the onset of a trial if there are no stimuli acting as barriers or (2) the end of the last stimulus acting as a barrier.
  • Possible values: A number in seconds (decimals are supported)
  • Default: 0 (no delay)

{
  "type": "image",
  "content": "image1.jpg",
  "delay": 1.6
}
The above code introduces a delay of 1600 milliseconds.

duration

  • Definition: Keep the image stimulus visible for a certain number of seconds relative to the onset of the stimulus
  • Possible values: A number; decimals are supported (e.g. 1.3)
  • Default (by omission): -1, meaning that the stimulus, once triggered, will stay on a trial indefinitely
  • In most cases, it is far more common to manipulate the duration of a trial instead. Please make sure you really intend to specify a duration for a specific stimulus before using this feature!

{
  "type": "image",
  "content": "image1.jpg",
  "duration": 2.4
}
The above code renders the image stimulus visible for 2400 milliseconds after the onset of the stimulus. Make sure you intend to specify the duration for the stimulus rather than the more common duration of a trial!

parent

  • Definition: If specified, then the properties of the specified stimulus will be inherited by this stimulus, unless a property of the same name is defined in this stimulus
  • Possible values: The name of another defined stimulus

"image0":{
  "type": "image",
  "content": "image0.jpg",
  "delay": 0.3,
  "width": "200px"
}
"image1": {
  "type": "image",
  "content": "image1.jpg",
  "parent": "image0",
  "width": "400px"
}
Here, the image1 stimulus inherits the delay property of image0. image1 does not inherit the width property of image0 because the stimulus definition of image1 has its own specified width property.

width

  • Definition: The width at which the image is displayed
  • Possible values: A number; percentages (e.g., "50%"), pixels (e.g., "200px"), and other CSS width control units are supported.
  • Default (by omission): The actual width of the image
{
  "type": "image",
  "content": "image1.jpg",
  "width": "200px"
}

See Also

Tokenized Image Stimulus