Photochk 1.0.0 — 類似写真を探して整理する macOS アプリ

フォルダ内の写真から、中身が同じものと見た目が似ているものを検出して
グループにまとめ、残す1枚を選んでほかをゴミ箱へ送れるようにする。

検出は安い判定から順に4段:
- ファイルサイズが同じものだけ SHA-256 でバイト一致を確定
- dHash(知覚ハッシュ)のハミング距離で候補ペアを抽出
- 候補に出てくる画像だけ Vision の feature print で精査
- Union-Find で連結成分をグループ化

判定のしきい値は実写画像で距離を実測して決めた(docs/calibration.md)。
tools/release-update.sh で Gitea のリリースを更新する。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
yfoxjp
2026-07-28 08:02:14 +09:00
co-authored by Claude Opus 5
commit c7f68b6cca
38 changed files with 3102 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
import Foundation
/// スキャン対象の写真1枚。ファイル URL を同一性とする。
struct PhotoAsset: Identifiable, Hashable, Sendable {
var id: URL { url }
let url: URL
let fileSize: Int64
let modificationDate: Date
/// EXIF の撮影日時。無ければファイルの作成日。
var captureDate: Date?
var pixelWidth: Int
var pixelHeight: Int
var fileName: String { url.lastPathComponent }
/// 画素数。代表選出の第一基準。
var pixelCount: Int { pixelWidth * pixelHeight }
var dimensionText: String {
pixelWidth > 0 && pixelHeight > 0 ? "\(pixelWidth) × \(pixelHeight)" : "—"
}
var fileSizeText: String {
ByteCountFormatter.string(fromByteCount: fileSize, countStyle: .file)
}
var captureDateText: String {
guard let captureDate else { return "—" }
return PhotoAsset.displayDateFormatter.string(from: captureDate)
}
private static let displayDateFormatter: DateFormatter = {
let f = DateFormatter()
f.dateStyle = .medium
f.timeStyle = .short
return f
}()
}