|
|
@ -169,21 +169,20 @@ public class Photo { |
|
|
|
String.Format("{0:D2}", DateTimeOriginal.Month), |
|
|
|
String.Format("{0:D2}", DateTimeOriginal.Day)); |
|
|
|
Directory.CreateDirectory(directory); |
|
|
|
Directory.CreateDirectory(Path.Combine(directory, "1-raw")); |
|
|
|
Directory.CreateDirectory(Path.Combine(directory, "2-jpg")); |
|
|
|
Directory.CreateDirectory(Path.Combine(directory, "3-edit")); |
|
|
|
Directory.CreateDirectory(Path.Combine(directory, "jpg")); |
|
|
|
string baseFilename = Path.GetFileName(Filename); |
|
|
|
|
|
|
|
string rawFilename = Path.ChangeExtension(Filename, "cr3"); |
|
|
|
// FIXME: if there's a JPG but not a RAW, make a "RAW" that's the
|
|
|
|
// camera's original JPG converted to something lossless (PNG? TIFF?).
|
|
|
|
if (Path.Exists(rawFilename)) { |
|
|
|
string rawOut = Path.Combine(directory, "1-raw", Path.GetFileName(rawFilename)); |
|
|
|
string rawOut = Path.Combine(directory, Path.GetFileName(rawFilename)); |
|
|
|
if (!Path.Exists(rawOut)) { |
|
|
|
System.IO.File.Copy(rawFilename, rawOut); |
|
|
|
toast.Set($"{rawFilename} => {rawOut}"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// FIXME: add comments / captions as ImageDescription?
|
|
|
|
using (Image<Rgba32> image = await Image.LoadAsync<Rgba32>(Filename)) { |
|
|
|
Util.RotateImageFromExif(image, Orientation); |
|
|
|
|
|
|
@ -215,19 +214,17 @@ public class Photo { |
|
|
|
|
|
|
|
image.Metadata.XmpProfile = UpdateXmp(image.Metadata.XmpProfile); |
|
|
|
|
|
|
|
string jpgOut = Path.Combine(directory, "2-jpg", baseFilename); |
|
|
|
await image.SaveAsync(jpgOut, new JpegEncoder() { Quality = 100 }); |
|
|
|
toast.Set($"{Filename} => {jpgOut}"); |
|
|
|
|
|
|
|
if (RotationDegreeHundredths != 0) { |
|
|
|
image.Mutate(x => x.Rotate(RotationDegreeHundredths / 100f)); |
|
|
|
} |
|
|
|
if (CropRectangle != Rectangle.Empty) { |
|
|
|
image.Mutate(x => x.Crop(CropRectangle)); |
|
|
|
} |
|
|
|
string editOut = Path.Combine(directory, "3-edit", baseFilename); |
|
|
|
await image.SaveAsync(editOut, new JpegEncoder() { Quality = 100 }); |
|
|
|
toast.Set($"{Filename} => {editOut}"); |
|
|
|
|
|
|
|
string jpgOut = Path.Combine(directory, "jpg", baseFilename); |
|
|
|
await image.SaveAsync(jpgOut, new JpegEncoder() { Quality = 100 }); |
|
|
|
toast.Set($"{Filename} => {jpgOut}"); |
|
|
|
|
|
|
|
// await image.SaveAsync(editOut, new PngEncoder() {
|
|
|
|
// BitDepth = PngBitDepth.Bit8, ChunkFilter = PngChunkFilter.None, ColorType = PngColorType.Rgb,
|
|
|
|
// CompressionLevel = PngCompressionLevel.BestCompression, FilterMethod = PngFilterMethod.Adaptive,
|
|
|
|