How to Convert Multiple Page PDF to JPG on Mac?

I'd like to convert a multiple page PDF into individual JPG files on my Mac. I need to do this for a project where I need to upload each page individually. I've tried using Preview and other online tools, but they only allow me to convert one page at a time. I have a total of 12 pages, so I'm looking for a way to do this in bulk.

As I'm not very familiar with complex software. Any suggestions or recommendations would be greatly appreciated. Thank you!

Posted on Nov 1, 2023 10:43 PM

Reply
Question marked as Top-ranking reply

Posted on Nov 2, 2023 5:22 AM

I have written a Shortcut that when used as a Quick Action on Monterey or later, it will allow you to select a PDF(s), split that PDF into sequentially numbered pages, and then convert each page into a JPG. This particular action would like you to have a PDF_Images folder on your Desktop before running it.


You can access this Split PDF into Images Shortcut at this location, and when you click the link, and then click Get Shortcut, it will be added to your Shortcuts from which you can run it via the Finder Quick Actions menu. You may need to change some settings in System Preferences to enable this as a Quick Action, but try it first to see.


https://www.icloud.com/shortcuts/d32b36feece4434e9ed9fcf78601407e

Similar questions

4 replies
Question marked as Top-ranking reply

Nov 2, 2023 5:22 AM in response to MatiHun

I have written a Shortcut that when used as a Quick Action on Monterey or later, it will allow you to select a PDF(s), split that PDF into sequentially numbered pages, and then convert each page into a JPG. This particular action would like you to have a PDF_Images folder on your Desktop before running it.


You can access this Split PDF into Images Shortcut at this location, and when you click the link, and then click Get Shortcut, it will be added to your Shortcuts from which you can run it via the Finder Quick Actions menu. You may need to change some settings in System Preferences to enable this as a Quick Action, but try it first to see.


https://www.icloud.com/shortcuts/d32b36feece4434e9ed9fcf78601407e

Nov 2, 2023 8:50 AM in response to MatiHun

If you do not want to deal with Shortcuts, I have just revised some attributed AppleScript/Objective-C code that allows you to select the PDF with a file chooser, and the rest is automatic. It is configured to do the following:


  1. Select the PDF
  2. Create an output folder for the split PDF images using the basename of the PDF as the output folder
  3. Split the PDF into 300 DPI (configurable) sequentially numbered JPG images into the folder from [2]


Copy/Paste the following code into an open Apple Script Editor, click the hammer icon to compile it, and then click the run button. The rest is automatic.


-- pdf2image.applescript
-- this is the PDF to JPG version

-- attribution: https://www.macscripter.net/t/pdf-to-tiff-script/74847

use framework "Cocoa"
use framework "PDFKit"
use AppleScript version "2.4" -- Yosemite or later
use scripting additions

property ca : current application
property resolution : 300.0

set thePDF to POSIX path of (choose file of type "com.adobe.pdf" default location (path to desktop)) as text
my pdf2jpg(thePDF, resolution)
return

on pdf2jpg(apdf, aresolution)
	set pdfURL to ca's NSURL's fileURLWithPath:apdf
	set pdf to ca's PDFDocument's alloc()'s initWithURL:pdfURL
	set pdfFolder to pdfURL's URLByDeletingLastPathComponent
	set pdfFileName to (pdfURL's URLByDeletingPathExtension())'s lastPathComponent()
	set newFolder to pdfFolder's URLByAppendingPathComponent:pdfFileName
	
	repeat with i from 1 to pdf's pageCount()
		set aPage to (pdf's pageAtIndex:(i - 1))
		set pageSize to (aPage's boundsForBox:(ca's kPDFDisplayBoxMediaBox))
		set pageWidth to ca's NSWidth(pageSize)
		set pageHeight to ca's NSHeight(pageSize)
		set pixelWidth to (pageWidth * aresolution / 72) div 1
		set pixelHeight to (pageHeight * aresolution / 72) div 1
		set theImageRep to (ca's NSPDFImageRep's imageRepWithData:(aPage's dataRepresentation()))
		set newImageRep to (ca's NSBitmapImageRep's alloc()'s initWithBitmapDataPlanes:(missing value) pixelsWide:pixelWidth pixelsHigh:pixelHeight bitsPerSample:8 samplesPerPixel:4 hasAlpha:yes isPlanar:false colorSpaceName:(current application's NSDeviceRGBColorSpace) bytesPerRow:0 bitsPerPixel:32)
		
		ca's NSGraphicsContext's saveGraphicsState()
		(ca's NSGraphicsContext's setCurrentContext:(ca's NSGraphicsContext's graphicsContextWithBitmapImageRep:newImageRep))
		ca's NSColor's whiteColor()'s |set|()
		ca's NSRectFill({origin:{x:0, y:0}, |size|:{width:pixelWidth, height:pixelHeight}})
		(theImageRep's drawInRect:{origin:{x:0, y:0}, |size|:{width:pixelWidth, height:pixelHeight}} fromRect:(ca's NSZeroRect) operation:(ca's NSCompositeSourceOver) fraction:1.0 respectFlipped:false hints:(missing value))
		ca's NSGraphicsContext's restoreGraphicsState()
		-- make 300 dpi pages instead of 72 dpi default if this is commented
		(newImageRep's setSize:{pageWidth, pageHeight}) -- if desired
		-- zero pad counter to three digits
		set paddedSequence to (ca's NSString's stringWithFormat:("_%02d" & i))
		set imageFileName to (pdfFileName's stringByAppendingString:paddedSequence)
		set theData to (newImageRep's representationUsingType:(ca's NSBitmapImageFileTypeJPEG) |properties|:{NSImageCompressionFactor:0.8}) -- 0.0 is maximum compresssion and 1.0 is no compression 
		set fileMgr to ca's NSFileManager's defaultManager()
		
		-- use the base filename as the folder to create at the current path
		-- will return true if folder already exists
		set {done, theError} to (fileMgr's createDirectoryAtURL:newFolder withIntermediateDirectories:true attributes:(missing value) |error|:(reference))
		if done as boolean then
			set theImage to ((newFolder's URLByAppendingPathComponent:imageFileName)'s URLByAppendingPathExtension:"jpg")
			(theData's writeToURL:theImage atomically:true)
		end if
	end repeat
	return
end pdf2jpg


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 Convert Multiple Page PDF to JPG on Mac?

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