Browse Source

Testing huge image

Former-commit-id: 642ac0ad1223b49214d0276ecb4971839b51a737
Former-commit-id: 50eca834b711f7b1da668e1245e55958b3aff0f1
pull/17/head
James South 12 years ago
parent
commit
4cc328401c
  1. 25
      src/ImageProcessor.Playground/Program.cs
  2. 1
      src/ImageProcessor.Playground/images/input/test5.jpg.REMOVED.git-id

25
src/ImageProcessor.Playground/Program.cs

@ -30,8 +30,6 @@ namespace ImageProcessor.PlayGround
/// </summary> /// </summary>
public class Program public class Program
{ {
protected static readonly IEnumerable<ISupportedImageFormat> formats = ImageProcessorBootstrapper.Instance.SupportedImageFormats;
/// <summary> /// <summary>
/// The main routine. /// The main routine.
/// </summary> /// </summary>
@ -50,14 +48,14 @@ namespace ImageProcessor.PlayGround
di.Create(); di.Create();
} }
Image mask = Image.FromFile(Path.Combine(resolvedPath, "mask.png")); // Image mask = Image.FromFile(Path.Combine(resolvedPath, "mask.png"));
Image overlay = Image.FromFile(Path.Combine(resolvedPath, "imageprocessor.128.png")); // Image overlay = Image.FromFile(Path.Combine(resolvedPath, "imageprocessor.128.png"));
//FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "monster.png")); FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "test5.jpg"));
IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".gif"); IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".gif");
//IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".gif", ".webp", ".bmp", ".jpg", ".png", ".tif"); //IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".gif", ".webp", ".bmp", ".jpg", ".png", ".tif");
foreach (FileInfo fileInfo in files) // foreach (FileInfo fileInfo in files)
{ // {
byte[] photoBytes = File.ReadAllBytes(fileInfo.FullName); byte[] photoBytes = File.ReadAllBytes(fileInfo.FullName);
Console.WriteLine("Processing: " + fileInfo.Name); Console.WriteLine("Processing: " + fileInfo.Name);
@ -93,7 +91,7 @@ namespace ImageProcessor.PlayGround
//.BackgroundColor(Color.Cyan) //.BackgroundColor(Color.Cyan)
//.ReplaceColor(Color.FromArgb(255, 223, 224), Color.FromArgb(121, 188, 255), 128) //.ReplaceColor(Color.FromArgb(255, 223, 224), Color.FromArgb(121, 188, 255), 128)
//.Resize(size) //.Resize(size)
// .Resize(new ResizeLayer(size, ResizeMode.Max)) .Resize(new ResizeLayer(size, ResizeMode.Max))
// .Resize(new ResizeLayer(size, ResizeMode.Stretch)) // .Resize(new ResizeLayer(size, ResizeMode.Stretch))
//.DetectEdges(new SobelEdgeFilter(), true) //.DetectEdges(new SobelEdgeFilter(), true)
//.DetectEdges(new LaplacianOfGaussianEdgeFilter()) //.DetectEdges(new LaplacianOfGaussianEdgeFilter())
@ -103,8 +101,8 @@ namespace ImageProcessor.PlayGround
//.Filter(MatrixFilters.Comic) //.Filter(MatrixFilters.Comic)
//.Flip() //.Flip()
//.Filter(MatrixFilters.HiSatch) //.Filter(MatrixFilters.HiSatch)
.Pixelate(8) //.Pixelate(8)
.Rotate(45) //.Rotate(45)
//.GaussianSharpen(10) //.GaussianSharpen(10)
//.Format(new PngFormat() { IsIndexed = true }) //.Format(new PngFormat() { IsIndexed = true })
//.Format(new PngFormat() { IsIndexed = true }) //.Format(new PngFormat() { IsIndexed = true })
@ -115,10 +113,13 @@ namespace ImageProcessor.PlayGround
} }
} }
Console.WriteLine(@"Completed {0} in {1:s\.fff} secs with peak memory usage of {2}.", fileInfo.Name, stopwatch.Elapsed, Process.GetCurrentProcess().PeakWorkingSet64.ToString("#,#")); long peakWorkingSet64 = Process.GetCurrentProcess().PeakWorkingSet64;
float mB = peakWorkingSet64 / (float)1024 / 1024;
Console.WriteLine(@"Completed {0} in {1:s\.fff} secs {2}Peak memory usage was {3} bytes or {4} Mb.", fileInfo.Name, stopwatch.Elapsed, Environment.NewLine, peakWorkingSet64.ToString("#,#"), mB);
//Console.WriteLine("Processed: " + fileInfo.Name + " in " + stopwatch.ElapsedMilliseconds + "ms"); //Console.WriteLine("Processed: " + fileInfo.Name + " in " + stopwatch.ElapsedMilliseconds + "ms");
} //}
Console.ReadLine(); Console.ReadLine();
} }

1
src/ImageProcessor.Playground/images/input/test5.jpg.REMOVED.git-id

@ -0,0 +1 @@
04f8079eef57529bd63ff1e8227703acbb45aa15
Loading…
Cancel
Save