Exemple #1
0
        private string CreateCollage(BaseItem primaryItem, IEnumerable <BaseItem> items, string outputPath, int width, int height)
        {
            Directory.CreateDirectory(Path.GetDirectoryName(outputPath));

            var options = new ImageCollageOptions
            {
                Height     = height,
                Width      = width,
                OutputPath = outputPath,
                InputPaths = GetStripCollageImagePaths(primaryItem, items).ToArray()
            };

            if (options.InputPaths.Length == 0)
            {
                return(null);
            }

            if (!ImageProcessor.SupportsImageCollageCreation)
            {
                return(null);
            }

            ImageProcessor.CreateImageCollage(options);
            return(outputPath);
        }
        private async Task <string> CreateCollage(IHasImages primaryItem, List <BaseItem> items, string outputPath, int width, int height)
        {
            FileSystem.CreateDirectory(Path.GetDirectoryName(outputPath));

            var options = new ImageCollageOptions
            {
                Height     = height,
                Width      = width,
                OutputPath = outputPath,
                InputPaths = GetStripCollageImagePaths(primaryItem, items).ToArray()
            };

            if (options.InputPaths.Length == 0)
            {
                return(null);
            }

            if (!ImageProcessor.SupportsImageCollageCreation)
            {
                return(null);
            }

            await ImageProcessor.CreateImageCollage(options).ConfigureAwait(false);

            return(outputPath);
        }
Exemple #3
0
        public void CreateImageCollage(ImageCollageOptions options)
        {
            _logger.Info("Creating image collage and saving to {0}", options.OutputPath);

            _imageEncoder.CreateImageCollage(options);

            _logger.Info("Completed creation of image collage and saved to {0}", options.OutputPath);
        }
        public async Task CreateImageCollage(ImageCollageOptions options)
        {
            await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);

            try
            {
                _imageEncoder.CreateImageCollage(options);
            }
            finally
            {
                _imageProcessingSemaphore.Release();
            }
        }
        private void CreateCollage(IHasImages primaryItem, List <BaseItem> items, string outputPath, int width, int height, bool drawText, string text)
        {
            Directory.CreateDirectory(Path.GetDirectoryName(outputPath));

            var options = new ImageCollageOptions
            {
                Height     = height,
                Width      = width,
                OutputPath = outputPath,
                Text       = drawText ? text : null,
                InputPaths = GetStripCollageImagePaths(primaryItem, items).ToArray()
            };

            ImageProcessor.CreateImageCollage(options);
        }
Exemple #6
0
        public async Task CreateImageCollage(ImageCollageOptions options)
        {
            await _imageProcessingSemaphore.WaitAsync().ConfigureAwait(false);

            try
            {
                _logger.Info("Creating image collage and saving to {0}", options.OutputPath);

                _imageEncoder.CreateImageCollage(options);

                _logger.Info("Completed creation of image collage and saved to {0}", options.OutputPath);
            }
            finally
            {
                _imageProcessingSemaphore.Release();
            }
        }
Exemple #7
0
        public void CreateImageCollage(ImageCollageOptions options)
        {
            double ratio = (double)options.Width / options.Height;

            if (ratio >= 1.4)
            {
                new StripCollageBuilder(this).BuildThumbCollage(options.InputPaths, options.OutputPath, options.Width, options.Height);
            }
            else if (ratio >= .9)
            {
                new StripCollageBuilder(this).BuildSquareCollage(options.InputPaths, options.OutputPath, options.Width, options.Height);
            }
            else
            {
                // TODO: Create Poster collage capability
                new StripCollageBuilder(this).BuildSquareCollage(options.InputPaths, options.OutputPath, options.Width, options.Height);
            }
        }
Exemple #8
0
        public void CreateImageCollage(ImageCollageOptions options)
        {
            double ratio = options.Width;

            ratio /= options.Height;

            if (ratio >= 1.4)
            {
                DynamicImageHelpers.CreateThumbCollage(options.InputPaths.ToList(), _fileSystem, options.OutputPath, options.Width, options.Height);
            }
            else if (ratio >= .9)
            {
                DynamicImageHelpers.CreateSquareCollage(options.InputPaths.ToList(), _fileSystem, options.OutputPath, options.Width, options.Height);
            }
            else
            {
                DynamicImageHelpers.CreateSquareCollage(options.InputPaths.ToList(), _fileSystem, options.OutputPath, options.Width, options.Width);
            }
        }
        public void CreateImageCollage(ImageCollageOptions options)
        {
            double ratio = options.Width;

            ratio /= options.Height;

            if (ratio >= 1.4)
            {
                new StripCollageBuilder(_appPaths).BuildThumbCollage(options.InputPaths, options.OutputPath, options.Width, options.Height, options.Text);
            }
            else if (ratio >= .9)
            {
                new StripCollageBuilder(_appPaths).BuildSquareCollage(options.InputPaths, options.OutputPath, options.Width, options.Height, options.Text);
            }
            else
            {
                new StripCollageBuilder(_appPaths).BuildPosterCollage(options.InputPaths, options.OutputPath, options.Width, options.Height, options.Text);
            }
        }
Exemple #10
0
        public void CreateImageCollage(ImageCollageOptions options)
        {
            double ratio = options.Width;

            ratio /= options.Height;

            if (ratio >= 1.4)
            {
                new StripCollageBuilder(_appPaths, _fileSystem).BuildThumbCollage(options.InputPaths, options.OutputPath, options.Width, options.Height);
            }
            else if (ratio >= .9)
            {
                new StripCollageBuilder(_appPaths, _fileSystem).BuildSquareCollage(options.InputPaths, options.OutputPath, options.Width, options.Height);
            }
            else
            {
                // @todo create Poster collage capability
                new StripCollageBuilder(_appPaths, _fileSystem).BuildSquareCollage(options.InputPaths, options.OutputPath, options.Width, options.Height);
            }
        }
Exemple #11
0
        private Task <bool> CreateCollage(IHasImages primaryItem, List <BaseItem> items, string outputPath, int width, int height)
        {
            Directory.CreateDirectory(Path.GetDirectoryName(outputPath));

            var options = new ImageCollageOptions
            {
                Height     = height,
                Width      = width,
                OutputPath = outputPath,
                InputPaths = GetStripCollageImagePaths(primaryItem, items).ToArray()
            };

            if (options.InputPaths.Length == 0)
            {
                return(Task.FromResult(false));
            }

            ImageProcessor.CreateImageCollage(options);
            return(Task.FromResult(true));
        }
Exemple #12
0
 public void CreateImageCollage(ImageCollageOptions options)
 {
     throw new NotImplementedException();
 }
Exemple #13
0
 /// <inheritdoc />
 public void CreateImageCollage(ImageCollageOptions options, string?libraryName)
 {
     throw new NotImplementedException();
 }
Exemple #14
0
 public void CreateImageCollage(ImageCollageOptions options)
 {
     _imageEncoder.CreateImageCollage(options);
 }