FYI: Generate custom Finder icon for RAW images (even if image format is not supported by macOS)

The method relies on 3 distinct parts (click on links for information/download).



The example below is based on Canon's CR3 RAW image format (supported since Big Sur). Workflow assumes images are located in ~/Pictures.


DNG Converter Configuration

Run the workflow in Automator (or create a standalone app from Automator). Workflow can easily be customized for other RAW images formats (see below).



Sample Output





Mac mini, macOS 12.2

Posted on Feb 14, 2022 7:37 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 14, 2022 12:19 PM

Another approach that does not use Adobe DNG converter, and instead uses the free third-party tool ExifTool.


In this case, it is an AppleScript that determines if ExifTool is installed and quits otherwise. It prompts for images of type public.camera-raw-image and then using that selected RAW image, will extract its internal icon data to a temp file. It then converts that temp data into an NSImage and proceeds to set the icon image on the RAW image.


# raw_icon.applescript

# extract the icon data from an unsupported camera RAW image and then set that image
# data on its icon.
# Dependency: ExifTool (https:exiftool.org) which installs into /usr/local/bin.
# Tested: macOS Big Sur 11.6.3, Exiftool 12.37

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

property NSImage : a reference to current application's NSImage
property NSWorkspace : a reference to current application's NSWorkspace

# get the shell so we know which source statement to use below to get PATH info
set shell to (do shell script "echo $SHELL")

if shell is "/bin/zsh" then
	set XIF to (do shell script "source ~/.zshrc;/usr/bin/which exiftool")
else if shell = "/bin/bash" then
	set XIF to (do shell script "source ~/.bash_profile;/usr/bin/which exiftool")
end if

if XIF is missing value or XIF is "" then
	display alert "Need ExifTool installed." giving up after 10
end if

# only allow camera RAW images
set theImage to POSIX path of (choose file of type {"public.camera-raw-image"} default location (path to desktop) without invisibles) as text

# now check if the RAW image really does not have an icon set on it and quit if it does
try
	# returns 13 if sips cannot extract icon from RAW image when it is not supported by camera RAW db
	set ret to (do shell script "sips -i " & theImage & " > /dev/null; echo $?")
	if ret = 0 then return # because image was on it
on error number -128
	# user canceled
	return
end try

# extract the image icon data from the RAW file
do shell script XIF & " -a -b -preview:all " & theImage & " > /tmp/XXImage.png"
set thisImg to NSImage's alloc()'s initWithContentsOfFile:"/tmp/XXImage.png"
set status to ((NSWorkspace's sharedWorkspace)'s setIcon:thisImg forFile:theImage options:0) as boolean
tell application "Finder"
	delete POSIX file "/tmp/XXImage.png" as alias
	if status then reveal POSIX file theImage as alias
end tell
return


For the Nikon Z fc RAW image:


From:

To:

Similar questions

17 replies

Feb 17, 2022 7:43 AM in response to BlueberryLover

I've updated the workflow (same link as above) to check for the presence of Exiftool. The workflow now skips over images which already have a custom icon (i.e. com.apple.FinderInfo extended attribute). Last, I realized that the CR3 file extension would need to be changed in a few places in the workflow in order to be used with another RAW file format.




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.

FYI: Generate custom Finder icon for RAW images (even if image format is not supported by macOS)

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