Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Loa

macrumors 68000
Original poster
May 5, 2003
1,723
75
Québec
Hello,

Is there a way to easily replace the title of an image in Photos with it's filename? Seems pointless to import images and *not* do this automatically...

Thanks
 
Last edited:

Jared G.K.

macrumors regular
Jul 23, 2023
123
160
I don't think this is possible. Maybe with scripting but this is beyond my capabilities.
May I ask why you want to do that? I'm really interested because I'm struggling with some of the quirks of the photos app too. But this never was an issue for me, as the title field usually is empty, and the file name shows under each image as long as there is no title.
 
  • Like
Reactions: Loa

Loa

macrumors 68000
Original poster
May 5, 2003
1,723
75
Québec
I'd really like to use the filename to sort in photos. Sometimes date works, but many of the files I deal with have had there metadata stripped and so when they're saved in PS, their dates become the current date.
 

NoBoMac

Moderator
Staff member
Jul 1, 2014
5,774
4,363
Might try setting it before importing into Photos. Seem to recall that Photos stores lots of things in a database these days, so makes it trickier to do things automagically in there.

So... exiftool might be an option. For all jpg files in a folder:

Code:
for img in `ls -1 *.jpg`
do
exiftool -ImageDescription="$img" -P "$img"
exiftool "-Description<ImageDescription" -P "$img"
done
 
  • Like
Reactions: Loa

Loa

macrumors 68000
Original poster
May 5, 2003
1,723
75
Québec
Yeah. When I can control how they are before I import, it's fine using Photos. But I have a bunch of old images that have no meta/exif data and while their filename are a good ordering method in finder, it doesn't work in Photos.
 

bogdanw

macrumors 603
Mar 10, 2009
5,690
2,724

Loa

macrumors 68000
Original poster
May 5, 2003
1,723
75
Québec
Yep! That script worked! Thanks!

P.S. For the people who will find this thread in the future, the automator type needed isn't service anymore, but Quick Action. Everything else works the same.
 
  • Like
Reactions: Dockland

RhetTbull

macrumors member
Apr 18, 2022
83
68
Los Angeles, CA
@Loa looks like you solved this with AppleScripts. I'm posting an alternative solution here for others that may come across this. I'm the author of the free open source tool, osxphotos which includes a batch-edit command that can easily do this. For example, you could run the following:
Bash:
osxphotos batch-edit --title "{original_name} {title}"
which will replace the title of any currently selected photos in Photos to the filename (minus extension) + any existing title. If you wanted the full filename with extension, you'd use
Bash:
osxphotos batch-edit --title "{photo.original_filename} {title}"
and if you wanted to overwrite any existing title instead of appending it, you'd use:
Bash:
osxphotos batch-edit --title "{original_name}"

This tool has a very flexible template system and can also adjust keywords, description (caption), and location.
 
  • Like
Reactions: Loa

Loco Sock

macrumors member
May 17, 2010
62
37
I know this thread is a little old.. but the issue I have is about 500 screenshots all named like:

Microsoft Word-2024_03_28-11_36_30.png
Google Chrome-2024_03_28-11_38_28.png

Yes, they are all: Appname - YYYY_MM_DD dash HH_MM_SS

I'm no good at regex.. tried Graphic Converter but I could set up the format to take the time/date from filename and set the time/date in EXIF so when I import them into iPhoto (Photos) it at least has the time and date.

Thanks.
 

RhetTbull

macrumors member
Apr 18, 2022
83
68
Los Angeles, CA
@Loco Sock

Install exiftool
Open Terminal
Change the the directory where your screenshots are then run this command:
exiftool "-alldates<filename" *.png
Or
exiftool "-alldates<filename" DIR

where DIR is the path to the directory containing the files.

That will update all the EXIF dates to match the date in the filename.
 
  • Like
Reactions: Loco Sock

Loco Sock

macrumors member
May 17, 2010
62
37
@Loco Sock

Install exiftool
Open Terminal
Change the the directory where your screenshots are then run this command:
exiftool "-alldates<filename" *.png
Or
exiftool "-alldates<filename" DIR

where DIR is the path to the directory containing the files.

That will update all the EXIF dates to match the date in the filename.
Thank you very much, I shall give that a shot here momentarily.

Worked perfectly! Thank you again.
 
Last edited:
  • Like
Reactions: RhetTbull
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.