Vision
Revised
Vision models accept images alongside text so the model can describe, classify, and answer questions about what it sees.?1
Quick startX17
ollama run gemma4 ./image.png what is in this image?
Usage with Ollama's API
Provide an images array.1 SDKs accept file paths, URLs,2 or raw bytes while the REST API expects base64-encoded image data.
cURL
# 1. Download a sample image
curl -L -o test.jpg "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
# 2. Encode the image
IMG=$(base64 < test.jpg | tr -d '\n')
# 3. Send it to Ollama
curl -X POST http://localhost:11434/api/chat \
-H "Content-Type: application/json" \
-d '{
"model": "gemma4",
"messages": [{
"role": "user",
"content": "What is in this image?",
"images": ["'"$IMG"'"]
}],
"stream": false
}'
Python
from ollama import chat
# from pathlib import Path
# Pass in the path to the image
path = input('Please enter the path to the image: ')
# You can also pass in base64 encoded image data
# img = base64.b64encode(Path(path).read_bytes()).decode()
# or the raw bytes
# img = Path(path).read_bytes()
response = chat(
model='gemma4',
messages=[
{
'role': 'user',
'content': 'What is in this image? Be concise.',
'images': [path],
}
],
)
print(response.message.content)
JavaScript
import ollama from 'ollama'
const imagePath = '/absolute/path/to/image.jpg'
const response = await ollama.chat({
model: 'gemma4',
messages: [
{ role: 'user', content: 'What is in this image?', images: [imagePath] }
],
stream: false,
})
console.log(response.message.content)
Notes on this page
1 Structure Audit: improved Puts the lead-in sentence in its own paragraph under the heading.
Was:
## Usage with Ollama's API Provide animagesarray.Auditor: The blank line separates the API lead-in into its own paragraph, making the section easier to scan.
2 Wording Audit: improved Adds the serial comma in a list of three.
Was:
file paths, URLs or raw bytespunct-serial-commaAuditor: The comma makes the three-item list follow the standard’s serial-comma convention.
Questions for the owner
?1 Should the page say what a successful response looks like, so a reader can confirm the image was understood?
About: “what it sees.”
X17 CLI form for passing an image. The CLI reference puts the image path inside the quoted prompt, while the Vision page passes the path as a separate argument before the prompt. Which form should both pages show, and are both supported?
Pages: CLI reference, Vision
Original
Vision models accept images alongside text so the model can describe, classify, and answer questions about what it sees.
Quick start
ollama run gemma4 ./image.png what is in this image?
Usage with Ollama's API
Provide an images array. SDKs accept file paths, URLs or raw bytes while the REST API expects base64-encoded image data.
cURL
# 1. Download a sample image
curl -L -o test.jpg "https://upload.wikimedia.org/wikipedia/commons/3/3a/Cat03.jpg"
# 2. Encode the image
IMG=$(base64 < test.jpg | tr -d '\n')
# 3. Send it to Ollama
curl -X POST http://localhost:11434/api/chat \
-H "Content-Type: application/json" \
-d '{
"model": "gemma4",
"messages": [{
"role": "user",
"content": "What is in this image?",
"images": ["'"$IMG"'"]
}],
"stream": false
}'
Python
from ollama import chat
# from pathlib import Path
# Pass in the path to the image
path = input('Please enter the path to the image: ')
# You can also pass in base64 encoded image data
# img = base64.b64encode(Path(path).read_bytes()).decode()
# or the raw bytes
# img = Path(path).read_bytes()
response = chat(
model='gemma4',
messages=[
{
'role': 'user',
'content': 'What is in this image? Be concise.',
'images': [path],
}
],
)
print(response.message.content)
JavaScript
import ollama from 'ollama'
const imagePath = '/absolute/path/to/image.jpg'
const response = await ollama.chat({
model: 'gemma4',
messages: [
{ role: 'user', content: 'What is in this image?', images: [imagePath] }
],
stream: false,
})
console.log(response.message.content)
What Changed
The page already passes the check, so the changes are small: a blank line after a heading so the lead-in sentence stands as its own paragraph, and a serial comma. Two questions remain for the owner, one about the CLI form for passing an image and one about showing what a successful response looks like.
Content type: task. The page shows how to send an image to a vision model from the CLI and the API, which is one job done in steps.
Automated check, original: 0 errors, 0 warnings, 0 suggestions. Revised: 0 errors, 0 warnings, 0 suggestions.
Independent audit (GPT-6): improved. The revision makes two small style improvements while preserving the page’s meaning and examples. It still leaves a generic heading and does not answer the reader’s next question about confirming a successful response.
What the revision missed:
- “Quick start” does not say what the section contains; the standard calls for headings that describe what is under them.
- The page does not show what a successful response looks like, leaving readers without a way to confirm the example worked; the notes raise this as a question but the revision does not resolve it.
Structure (1)
- 1 Puts the lead-in sentence in its own paragraph under the heading. improved
Wording (1)
- 2 Adds the serial comma in a list of three. improved