Example #1
0
        /// <inheritdoc />
        /// <exception cref="ArgumentNullException">The path is null.</exception>
        /// <exception cref="FileNotFoundException">The path is not valid.</exception>
        /// <exception cref="SkiaCodecException">The file at the specified path could not be used to generate a codec.</exception>
        public string GetImageBlurHash(int xComp, int yComp, string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            return(BlurHashEncoder.Encode(xComp, yComp, path));
        }
        /// <inheritdoc />
        /// <exception cref="ArgumentNullException">The path is null.</exception>
        /// <exception cref="FileNotFoundException">The path is not valid.</exception>
        /// <exception cref="SkiaCodecException">The file at the specified path could not be used to generate a codec.</exception>
        public string GetImageBlurHash(int xComp, int yComp, string path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            // Any larger than 128x128 is too slow and there's no visually discernible difference
            return(BlurHashEncoder.Encode(xComp, yComp, path, 128, 128));
        }
        public void Encode_Success(string relPath, int xComponent, int yComponent, string expectedResult)
        {
            string absPath = Path.Join(Environment.GetEnvironmentVariable("FFMPEG_SAMPLES_PATH"), relPath);

            Assert.Equal(expectedResult, BlurHashEncoder.Encode(xComponent, yComponent, absPath));
        }