|
@ -161,7 +161,7 @@ public class Photo { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public async void SaveAsJpegAsync(string outputRoot) { |
|
|
|
|
|
|
|
|
public async void SaveAsync(string outputRoot, Toast toast) { |
|
|
// FIXME: if nothing was changed about this image, just copy the file bytes directly, possibly with metadata changed?
|
|
|
// FIXME: if nothing was changed about this image, just copy the file bytes directly, possibly with metadata changed?
|
|
|
string directory = Path.Combine( |
|
|
string directory = Path.Combine( |
|
|
outputRoot, |
|
|
outputRoot, |
|
@ -178,8 +178,8 @@ public class Photo { |
|
|
if (Path.Exists(rawFilename)) { |
|
|
if (Path.Exists(rawFilename)) { |
|
|
string rawOut = Path.Combine(directory, "1-raw", Path.GetFileName(rawFilename)); |
|
|
string rawOut = Path.Combine(directory, "1-raw", Path.GetFileName(rawFilename)); |
|
|
if (!Path.Exists(rawOut)) { |
|
|
if (!Path.Exists(rawOut)) { |
|
|
Console.WriteLine($"{rawFilename} => {rawOut}"); |
|
|
|
|
|
System.IO.File.Copy(rawFilename, rawOut); |
|
|
System.IO.File.Copy(rawFilename, rawOut); |
|
|
|
|
|
toast.Set($"{rawFilename} => {rawOut}"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -216,8 +216,8 @@ public class Photo { |
|
|
image.Metadata.XmpProfile = UpdateXmp(image.Metadata.XmpProfile); |
|
|
image.Metadata.XmpProfile = UpdateXmp(image.Metadata.XmpProfile); |
|
|
|
|
|
|
|
|
string jpgOut = Path.Combine(directory, "2-jpg", baseFilename); |
|
|
string jpgOut = Path.Combine(directory, "2-jpg", baseFilename); |
|
|
Console.WriteLine($"{Filename} => {jpgOut}"); |
|
|
|
|
|
await image.SaveAsync(jpgOut, new JpegEncoder() { Quality = 100 }); |
|
|
await image.SaveAsync(jpgOut, new JpegEncoder() { Quality = 100 }); |
|
|
|
|
|
toast.Set($"{Filename} => {jpgOut}"); |
|
|
|
|
|
|
|
|
if (RotationDegreeHundredths != 0) { |
|
|
if (RotationDegreeHundredths != 0) { |
|
|
image.Mutate(x => x.Rotate(RotationDegreeHundredths / 100f)); |
|
|
image.Mutate(x => x.Rotate(RotationDegreeHundredths / 100f)); |
|
@ -226,8 +226,8 @@ public class Photo { |
|
|
image.Mutate(x => x.Crop(CropRectangle)); |
|
|
image.Mutate(x => x.Crop(CropRectangle)); |
|
|
} |
|
|
} |
|
|
string editOut = Path.Combine(directory, "3-edit", baseFilename); |
|
|
string editOut = Path.Combine(directory, "3-edit", baseFilename); |
|
|
Console.WriteLine($"{Filename} => {editOut}"); |
|
|
|
|
|
await image.SaveAsync(editOut, new JpegEncoder() { Quality = 100 }); |
|
|
await image.SaveAsync(editOut, new JpegEncoder() { Quality = 100 }); |
|
|
|
|
|
toast.Set($"{Filename} => {editOut}"); |
|
|
// await image.SaveAsync(editOut, new PngEncoder() {
|
|
|
// await image.SaveAsync(editOut, new PngEncoder() {
|
|
|
// BitDepth = PngBitDepth.Bit8, ChunkFilter = PngChunkFilter.None, ColorType = PngColorType.Rgb,
|
|
|
// BitDepth = PngBitDepth.Bit8, ChunkFilter = PngChunkFilter.None, ColorType = PngColorType.Rgb,
|
|
|
// CompressionLevel = PngCompressionLevel.BestCompression, FilterMethod = PngFilterMethod.Adaptive,
|
|
|
// CompressionLevel = PngCompressionLevel.BestCompression, FilterMethod = PngFilterMethod.Adaptive,
|
|
|