How to add sequential numbers to images in Pages

How do I add sequential numbers to images in Apple pages?

MacBook Pro 13″, macOS 15.7

Posted on Jan 17, 2026 2:53 AM

Reply
Question marked as Top-ranking reply

Posted on Jan 17, 2026 1:23 PM

As noted, there's no built-in automatic way to do this.


However, it may be scriptable.


The followed script looks at the front document and iterates through all the images in that document, adding a new text box below with the simple caption "Image " and the image number.


There are several caveats - the results may vary depending on page-based vs. document-based, due to the way the images are placed, but it should give you a good start.


tell application "Pages"
	-- here's the image counter
	set image_counter to 1
	-- get the front document
	tell document 1
		-- loop through the pages
		repeat with page_num from 1 to (count pages)
			tell page page_num
				-- get the images on this page
				set page_images to its images
				-- and loop through them
				repeat with i in page_images
					tell i
						-- get the image's position and dimensions so we can work out where to place the caption
						set {x, y} to its {width, height}
						set {loc_x, loc_y} to its position
					end tell
					-- make a new text box
					set image_caption_box to make new text item 
                     -- set the parameters of the box
					tell image_caption_box
						set object text to "Image " & image_counter
						set position to {loc_x, loc_y + y}
						set height to 24
					end tell
					-- and increment the counter
					set image_counter to image_counter + 1
				end repeat
			end tell
		end repeat
	end tell
end tell


Paste this into a new Script Editor document and click Run (use a copy of your document first, just in case :) )

The comments should give you an idea of what the script is doing.

6 replies
Question marked as Top-ranking reply

Jan 17, 2026 1:23 PM in response to cristinadias

As noted, there's no built-in automatic way to do this.


However, it may be scriptable.


The followed script looks at the front document and iterates through all the images in that document, adding a new text box below with the simple caption "Image " and the image number.


There are several caveats - the results may vary depending on page-based vs. document-based, due to the way the images are placed, but it should give you a good start.


tell application "Pages"
	-- here's the image counter
	set image_counter to 1
	-- get the front document
	tell document 1
		-- loop through the pages
		repeat with page_num from 1 to (count pages)
			tell page page_num
				-- get the images on this page
				set page_images to its images
				-- and loop through them
				repeat with i in page_images
					tell i
						-- get the image's position and dimensions so we can work out where to place the caption
						set {x, y} to its {width, height}
						set {loc_x, loc_y} to its position
					end tell
					-- make a new text box
					set image_caption_box to make new text item 
                     -- set the parameters of the box
					tell image_caption_box
						set object text to "Image " & image_counter
						set position to {loc_x, loc_y + y}
						set height to 24
					end tell
					-- and increment the counter
					set image_counter to image_counter + 1
				end repeat
			end tell
		end repeat
	end tell
end tell


Paste this into a new Script Editor document and click Run (use a copy of your document first, just in case :) )

The comments should give you an idea of what the script is doing.

Jan 18, 2026 4:37 PM in response to VikingOSX

> Too bad Apple emaciated the Pages Scripting Dictionary so that one cannot select the image and its accompanying Text caption box, then group them for subsequent combined movement (if desired).


Yeah... that could be possible via AppleScript to trigger UI scripting of command-option-G, but it would be nice to be able to do directly.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to add sequential numbers to images in Pages

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.