You are here: /Migrating from macOS to Linux/Migration to Linux: Photos
💡
|
TL;DR: Just Export Unmodified Originals with XMP-sidecar-file around 5,000 at a time!
|
HowTo
🚧
|
This applies to macOS 10.15.7 and Photos 5.0 (161.0.120). Mileage may vary.
|
- Walk all your events and albums and write their Name as Keyword into the metadata
- Export the photos - there are three ways to go:
- Use the Export feature, make sure all meta data is used. -> This will get you less files than you expect take very long!
- Pro: You get all metadata
- Con: Don't export more nach 20.000 files at once, Photos will hog all memory otherwise and stall. Also the filesize might change, depending on your (jpeg-) quality setting!
- Export originals -> Will export just the originals*, make sure you enable saving the XMP-sidecar-file!
- Pro: Fast! No quality loss.
- With XMP-sidecar enabled you can import it with all your precious tags!
- Con: Raw or .heic will stay the same - not every target system will know how to read them.
- Drag & Drop the files -> This will get you exactly what you expect, f.e. dragging 1285 photos got me 1285 files. Photos seems just to "copy" files without any conversion.
- Pro: Fast! No quality loss.
- Con: Raw or .heic will stay the same - not every target system will know how to read them.
- Copy the files to your Linux machine, view them f.e. in digiKam
- Sort out the mess of keywords :-)
originals: This means the files as they are in the Library.
|
Photos (Count) |
Files (Count) |
Files (KB) |
Keywords |
Note
|
Drag & Drop |
1285 |
1285 |
974,592 |
No |
This seems to alter the files like exporting, but sizes are nearly identical to "Export Originals"
|
Export |
1285 |
1285 |
2,208,896 |
Yes |
This recalculates every single photo to save it according to your settings.
|
Export Originals |
1285 |
1285 |
974,592 |
No |
This exports the files as they are in the library. Optionally with XMP-sidecar-file. This should be the way to go.
|
💡
|
If export of certain items fail: Maybe you export with title als filename and you have a "Haus.heic" and "HAus.heic". The second won't be written because it exists (depending on filesystem). This seems to be a bug in the exporter which doesn't make 100% sure files get unique names.
|
Sandbox
Applescripts
Export Selection
set dest to "/Volumes/Icy SSD III/S " as POSIX file -- the destination folder (use a valid path)
tell application "Photos"
activate
set sel to selection
export sel to (file dest) without using originals
end tell
This exports just the same as "Export" above. No benefit here.
Export metadata for later use
💡
|
This might be also accomplished by exporting originals with the XMP-Sidecar file!
|
set dest to "/Volumes/Icy SSD III/metadata.txt" as string --POSIX file --as text
set gTab to "\"\t\""
with timeout of 3600 seconds
tell application "Photos"
activate
set sel to selection
tell AppleScript to do shell script ("echo \"FILE\tNAME\tDESCRIPTION\tFAVORITE\tDATE\tID\tHEIGHT\tWIDTH\tALTITUDE\tSIZE\tLOCATION\tKEYWORDS\" > " & my escapedString(dest))
repeat with i from 1 to length of sel
set oneItem to item i of sel
tell oneItem
set oneItemKeywords to keywords -- as list of texts
set oneItemName to name
set oneItemDescription to description
set oneItemFavorite to favorite
set oneItemDate to date
set oneItemID to id
set oneItemHeight to height
set oneItemWidth to width
set oneItemFilename to filename
set oneItemAltitude to altitude
set oneItemSize to size
set oneItemLocation to location
end tell
set oneItemFilename to my cut(oneItemID, "/", 1)
tell AppleScript to do shell script "echo " & oneItemFilename & gTab & oneItemName & gTab & "\"" & oneItemDescription & "\"" & gTab & oneItemFavorite & gTab & oneItemDate & gTab & oneItemID & gTab & oneItemHeight & gTab & oneItemWidth & gTab & oneItemAltitude & gTab & oneItemSize & gTab & oneItemLocation & gTab & "\"" & oneItemKeywords & "\"" & " >> " & my escapedString(dest)
end repeat
end tell
end timeout
(* log cut("foo:bar:gaga", ":", 1) *)
on cut(str, delim, field)
set oldAST to AppleScript's text item delimiters
set AppleScript's text item delimiters to delim
set elements to text items of str
set AppleScript's text item delimiters to oldAST
set res to item field of elements
return res
end cut
on escapedString(stringToEscape)
set res to (changeSubString of stringToEscape from " " to "\\ ") (* Spaces escapen *)
set res to (changeSubString of res from ";" to "\\;") (* Semikolon escapen *)
log res
return (res)
end escapedString
to changeSubString of t from s to r
set d to text item delimiters
set text item delimiters to s
set t to t's text items
set text item delimiters to r
tell t to set t to beginning & ({""} & rest)
set text item delimiters to d
t
end changeSubString
Shellscripts
🚧
|
Delay that order…
Now that we've exported files AND metadata, merge them with a shellscript…unnecessary, XMP-sidecar files will do the trick!
|
Weblinks
http://www.oldtoad.net/TT/No.P01.html