feat: owner review 2 phase 4b: mass conversion after import (#13)
CI / Build and test (push) Failing after 3m1s
CI / PostgreSQL 16 integration (push) Skipped
CI / PostgreSQL 17 integration (push) Skipped
CI / Docker image (push) Skipped
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 10s
Release / Build, test and publish (push) Successful in 15m31s
Release / Server image (push) Successful in 1m13s
CI / Build and test (push) Failing after 3m1s
CI / PostgreSQL 16 integration (push) Skipped
CI / PostgreSQL 17 integration (push) Skipped
CI / Docker image (push) Skipped
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 10s
Release / Build, test and publish (push) Successful in 15m31s
Release / Server image (push) Successful in 1m13s
Convert photos already in the archive to JPEG, TIFF-16 or Linear DNG, from the panel's Library and the desktop's Archive and Library. Each run asks Replace (same frames, originals to the trash, recoverable) or New sequence. A dry run lists what converts, what is skipped and why, size before and after, and free space; the job converts exactly the confirmed photos, resumes, and commits all or nothing per sequence. A conversion never changes what Chronos reads from a photo. Replaced originals are erased only on the archive's own word that their conversion is gone. Desktop TIFFs that WIC showed black or as noise now go to the managed reader; the Edit picker no longer spins a core. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
This commit was merged in pull request #13.
This commit is contained in:
1 parent
7e4a3b481d
commit
efa87f68ce
354 files changed
+24530
-843
No files matched your search
@@ -6,9 +6,10 @@ using Chronos.Core.Metadata.Tiff;
|
||||
namespace Chronos.Core.Metadata;
|
||||
|
||||
/// <summary>
|
||||
/// Writes a minimal, valid little-endian Exif block for proxies and exports (BRIEF §8.5, §9): IFD0 (camera, orientation,
|
||||
/// software, date, authorship), the Exif IFD (capture time with sub-seconds and offset, exposure, lens and body) and,
|
||||
/// when known, the GPS IFD. Strings longer than <see cref="MaxStringBytes"/> UTF-8 bytes are truncated.
|
||||
/// Writes a minimal, valid little-endian Exif block for proxies, exports and converted frames (BRIEF §8.5, §9; owner
|
||||
/// review 2, R7): IFD0 (camera, orientation, software, date, authorship), the Exif IFD (capture time with sub-seconds and
|
||||
/// offset, exposure, exposure program, metering mode, flash, white balance, lens and body) and, when known, the GPS IFD.
|
||||
/// Strings longer than <see cref="MaxStringBytes"/> UTF-8 bytes are truncated.
|
||||
/// </summary>
|
||||
public static class ExifWriter
|
||||
{
|
||||
@@ -60,6 +61,10 @@ public static class ExifWriter
|
||||
if (m.UtcOffsetMinutes is { } offset && Math.Abs(offset) < 24 * 60)
|
||||
exif.Ascii(TiffTags.OffsetTimeOriginal, $"{(offset < 0 ? '-' : '+')}{Math.Abs(offset) / 60:D2}:{Math.Abs(offset) % 60:D2}");
|
||||
exif.SRational(TiffTags.ExposureBiasValue, m.ExposureBias);
|
||||
exif.Mode(TiffTags.ExposureProgram, m.ExposureProgram);
|
||||
exif.Mode(TiffTags.MeteringMode, m.MeteringMode);
|
||||
exif.Mode(TiffTags.Flash, m.Flash);
|
||||
exif.Mode(TiffTags.WhiteBalance, m.WhiteBalanceMode);
|
||||
exif.Rational(TiffTags.FocalLength, m.FocalLength);
|
||||
if (m.FocalLength35 is { } f35 and > 0 and < MaxShortIso) exif.Short(TiffTags.FocalLengthIn35mmFilm, (ushort)Math.Round(f35));
|
||||
exif.Ascii(TiffTags.BodySerialNumber, m.BodySerial);
|
||||
@@ -190,6 +195,12 @@ public static class ExifWriter
|
||||
Bytes(tag, TiffType.Short, data);
|
||||
}
|
||||
|
||||
/// <summary>A SHORT mode or bit field (exposure program, metering, flash, white balance), when known and in range.</summary>
|
||||
public void Mode(ushort tag, int? value)
|
||||
{
|
||||
if (value is { } v and >= 0 and <= ushort.MaxValue) Short(tag, (ushort)v);
|
||||
}
|
||||
|
||||
public void Long(ushort tag, uint value)
|
||||
{
|
||||
var data = new byte[4];
|
||||
|
||||
@@ -187,12 +187,13 @@ internal static class JpegParser
|
||||
m.AddXmp(buffer);
|
||||
}
|
||||
|
||||
private readonly record struct Segment(byte Marker, long Payload, int Length);
|
||||
/// <summary>A marker segment: its marker, where its payload starts, and the payload bytes present (0 for markers without one).</summary>
|
||||
internal readonly record struct Segment(byte Marker, long Payload, int Length);
|
||||
|
||||
private readonly record struct ExtendedXmpChunk(string Guid, uint FullLength, uint Offset, long Position, int Length);
|
||||
|
||||
/// <summary>Walks marker segments of one JPEG, reading only marker and length bytes within a read budget.</summary>
|
||||
private sealed class SegmentScanner(Stream stream, long start, long end, long readBudget)
|
||||
internal sealed class SegmentScanner(Stream stream, long start, long end, long readBudget)
|
||||
{
|
||||
private readonly byte[] _buffer = new byte[16];
|
||||
private long _position = start + 2;
|
||||
|
||||
@@ -42,9 +42,16 @@ public static class TiffTags
|
||||
public const ushort Xmp = 0x02BC;
|
||||
public const ushort Copyright = 0x8298;
|
||||
public const ushort ExifIfd = 0x8769;
|
||||
|
||||
/// <summary>InterColorProfile: the ICC profile of the image's colour space (UNDEFINED bytes).</summary>
|
||||
public const ushort InterColorProfile = 0x8773;
|
||||
|
||||
public const ushort GpsIfd = 0x8825;
|
||||
public const ushort InteropIfd = 0xA005;
|
||||
|
||||
/// <summary>InteroperabilityIndex in the Interop IFD: "R98" (sRGB) or "R03" (Adobe RGB, DCF option file).</summary>
|
||||
public const ushort InteropIndex = 0x0001;
|
||||
|
||||
// Exif
|
||||
public const ushort ExposureTime = 0x829A;
|
||||
public const ushort FNumber = 0x829D;
|
||||
|
||||
Reference in new issue
Block a user