Пример #1
0
        protected async Task <byte[]> ResizeImageBytes(byte[] imageData, uint?desiredWidth, uint?desiredHeight)
        {
            using (FluentBuildJob job = new FluentBuildJob())
            {
                BuildJobResult res = await job.Decode(imageData).ConstrainWithin(desiredWidth, desiredHeight)
                                     .EncodeToBytes(new LibPngEncoder()).FinishAsync();

                ArraySegment <byte>?bytes = res.First.TryGetBytes();
                return(bytes.HasValue ? bytes.Value.Array : new byte[] { });
            }
        }
Пример #2
0
        protected async Task <(int Width, int Height)> GetImageSize(string filename)
        {
            using (FluentBuildJob job = new FluentBuildJob())
            {
                byte[]         imageData = System.IO.File.ReadAllBytes(filename);
                BuildJobResult res       = await job.Decode(imageData)
                                           .EncodeToBytes(new LibPngEncoder()).FinishAsync();

                return(res.First.Width, res.First.Height);
            }
        }
 public ImageJobInstrumentation(BuildJobResult jobResult)
 {
     FinalWidth          = jobResult.EncodeResults.FirstOrDefault()?.Width;
     FinalHeight         = jobResult.EncodeResults.FirstOrDefault()?.Height;
     TotalTicks          = jobResult.PerformanceDetails.GetTotalWallTicks();
     DecodeTicks         = jobResult.PerformanceDetails.GetDecodeWallTicks();
     EncodeTicks         = jobResult.PerformanceDetails.GetEncodeWallTicks();
     SourceFileExtension = jobResult.DecodeResults.FirstOrDefault()?.PreferredExtension;
     SourceHeight        = jobResult.DecodeResults.FirstOrDefault()?.Height;
     SourceWidth         = jobResult.DecodeResults.FirstOrDefault()?.Width;
     ImageDomain         = null;
     PageDomain          = null;
     FinalCommandKeys    = null;
 }
Пример #4
0
 public void Notify(string notificationRecieverIdentifier, string buildIdentifier, BuildJobResult buildResult, string message)
 {
     throw new NotImplementedException();
 }