|
|
@ -4,6 +4,7 @@ using SixLabors.ImageSharp.Metadata.Profiles.Exif; |
|
|
|
using SixLabors.ImageSharp.Metadata.Profiles.Xmp; |
|
|
|
using SixLabors.ImageSharp.Formats; |
|
|
|
using SixLabors.ImageSharp.Formats.Jpeg; |
|
|
|
using SixLabors.ImageSharp.Formats.Png; |
|
|
|
using static System.IO.Path; |
|
|
|
using System.Text; |
|
|
|
using System.Xml.Linq; |
|
|
@ -159,7 +160,7 @@ public class Photo { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public async void SaveAsJpegAsync(string outputRoot, JpegEncoder encoder) { |
|
|
|
public async void SaveAsJpegAsync(string outputRoot) { |
|
|
|
// FIXME: if nothing was changed about this image, just copy the file bytes directly, possibly with metadata changed?
|
|
|
|
string directory = Path.Combine( |
|
|
|
outputRoot, |
|
|
@ -215,14 +216,18 @@ public class Photo { |
|
|
|
|
|
|
|
string jpgOut = Path.Combine(directory, "2-jpg", baseFilename); |
|
|
|
Console.WriteLine($"{Filename} => {jpgOut}"); |
|
|
|
await image.SaveAsync(jpgOut, encoder); |
|
|
|
await image.SaveAsync(jpgOut, new JpegEncoder() { Quality = 100 }); |
|
|
|
|
|
|
|
if (CropRectangle != Rectangle.Empty) { |
|
|
|
image.Mutate(x => x.Crop(CropRectangle)); |
|
|
|
} |
|
|
|
string editOut = Path.Combine(directory, "3-edit", baseFilename); |
|
|
|
Console.WriteLine($"{Filename} => {editOut}"); |
|
|
|
await image.SaveAsync(editOut, encoder); |
|
|
|
await image.SaveAsync(editOut, new JpegEncoder() { Quality = 100 }); |
|
|
|
// await image.SaveAsync(editOut, new PngEncoder() {
|
|
|
|
// BitDepth = PngBitDepth.Bit8, ChunkFilter = PngChunkFilter.None, ColorType = PngColorType.Rgb,
|
|
|
|
// CompressionLevel = PngCompressionLevel.BestCompression, FilterMethod = PngFilterMethod.Adaptive,
|
|
|
|
// InterlaceMethod = PngInterlaceMode.None });
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|