Stacks: Add 'rotational' hash attribute to images #1523

Open
opened 2026-02-20 00:14:17 -05:00 by deekerman · 0 comments
Owner

Originally created by @rarawls on GitHub (Aug 7, 2022).

In order to 'stack' photos that are the same photo, except either (1) only metadata differs and/or (2) the image has been losslessly rotated... add an additional hash attribute which can be used for stacking and duplicate handling. This does not replace the need/use for taking a hash of the entire file. It adds to duplicate detection/handling.

Disclaimer: probably a more efficient way to do this...

Implementation: For each image, hash the image data only (no metadata) for each possible rotation of the image (0, 90, 180, 270). Sort, concatenate, and hash those four digests. The resulting digest will be the 'rotational hash' of the image and will be shared amongst that same image, regardless of orientation or metadata. Stack the directory, filename, metadata, etc. per usual.

Background: I have duplicates upon duplicates of images that have been managed with different software over the years. My desire is to dump them all into one directory tree and then import them. Many of those files are the exact same file, but rotated. Or they are they have a GPS location added to exif. It would be awesome if those kinds of things got stacked under one photo and (when implemented) deduped.

See https://github.com/knjcode/imgdupes for a basic example of the idea.

Originally created by @rarawls on GitHub (Aug 7, 2022). In order to 'stack' photos that are the same photo, except either (1) only metadata differs and/or (2) the image has been losslessly rotated... add an additional hash attribute which can be used for stacking and duplicate handling. This does not replace the need/use for taking a hash of the entire file. It adds to duplicate detection/handling. **Disclaimer**: probably a more efficient way to do this... **Implementation**: For each image, hash the image data only (no metadata) for each possible rotation of the image (0, 90, 180, 270). Sort, concatenate, and hash those four digests. The resulting digest will be the 'rotational hash' of the image and will be shared amongst that same image, regardless of orientation or metadata. Stack the directory, filename, metadata, etc. per usual. **Background**: I have duplicates upon duplicates of images that have been managed with different software over the years. My desire is to dump them all into one directory tree and then import them. Many of those files are the exact same file, but rotated. Or they are they have a GPS location added to exif. It would be _awesome_ if those kinds of things got stacked under one photo and (when implemented) deduped. See https://github.com/knjcode/imgdupes for a basic example of the idea.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/photoprism#1523
No description provided.