@ -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 ( 4 5 )
//.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 ) 1 0 2 4 / 1 0 2 4 ;
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 ( ) ;
}
}