public void WhenWritingABlankCreatedJpegToAValidFileWriteAValidFile() { Image emptyImage = Image.Create(10, 10); ValidateCreatedImage(emptyImage, 10, 10); string tempFilePath = Path.ChangeExtension(Path.GetTempFileName(), ".jpg"); Jpg.Write(emptyImage, tempFilePath); File.Delete(tempFilePath); }
public static void WhenAddingANegativeFilterToAJpegGiveAValidGreyScaledImage() { string filepath = SaveEmbeddedResourceToFile(SquareCatLogicalName); Image img1 = Jpg.Load(filepath); img1.ApplyMatrixMultiplier(ImageExtensions.NegativeMatrix); ValidateImageJpeg(img1, SquareCatLogicalName); Jpg.Write(img1, Path.GetTempPath() + "NegativeCat.jpg"); }
public void WhenWritingABlankCreatedJpegToAValidStreamWriteAValidStream() { Image img = Image.Create(100, 100); using (MemoryStream stream = new MemoryStream()) { Jpg.Write(img, stream); stream.Position = 0; Image img2 = Jpg.Load(stream); ValidateCreatedImage(img2, 100, 100); } }
public void WhenWritingAJpegFromFileToAValidStreamWriteAValidImage() { string filepath = SaveEmbeddedResourceToFile(SoccerCatLogicalName); Image img = Jpg.Load(filepath); using (MemoryStream stream = new MemoryStream()) { Jpg.Write(img, stream); stream.Position = 0; Image img2 = Jpg.Load(stream); ValidateImageJpeg(img2, SoccerCatLogicalName); } File.Delete(filepath); }
public void WhenWritingAResizedJpegToAValidStreamWriteAValidImage() { string filepath = SaveEmbeddedResourceToFile(SoccerCatLogicalName); Image img = Jpg.Load(filepath); using (MemoryStream stream = new MemoryStream()) { img = img.Resize(40, 40); ValidateCreatedImage(img, 40, 40); Jpg.Write(img, stream); stream.Position = 0; Image img2 = Jpg.Load(stream); ValidateCreatedImage(img, 40, 40); } File.Delete(filepath); }
//FIX Write private static void WriteFileJpegPerfTest(int numRuns) { //string dir = Path.GetTempPath(); Image _thisjpgdog = Jpg.Load(jpegDogPath); for (int i = 0; i < numRuns; i++) { //make sure it's going if (i % 100 == 0) { Console.WriteLine("WriteJpegTest :" + i); } stopwatchSingleThread.Start(); Jpg.Write(_thisjpgdog, Path.ChangeExtension(Path.GetTempFileName(), ".jpg")); stopwatchSingleThread.Stop(); } _thisjpgdog.ReleaseStruct(); }
private static void WriteStreamJpegPerfTest(int numRuns) { Image _thisjpgcat = Jpg.Load(jpegCatPath); for (int i = 0; i < numRuns; i++) { //make sure it's going if (i % 100 == 0) { Console.WriteLine("WriteJpegTest :" + i); } using (MemoryStream stream = new MemoryStream()) { stopwatchSingleThread.Start(); Jpg.Write(_thisjpgcat, stream); stopwatchSingleThread.Stop(); } } _thisjpgcat.ReleaseStruct(); }