Skip to content

rasouliali/ImageResize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project is Image Resizer for Linux machins.
  
This project is used from SkiaSharp library and SkiaSharp.NativeAssets.Linux library.





        public static void ResizeImage(Stream fileContents,
        int maxWidth, int maxHeight, string saveFilePath,
        SKFilterQuality quality = SKFilterQuality.Medium)
        {
            fileContents.Seek(0, SeekOrigin.Begin);
            using SKBitmap sourceBitmap = SKBitmap.Decode(fileContents);

            using SKBitmap scaledBitmap = sourceBitmap.Resize(new SKImageInfo(maxWidth, maxHeight), quality);
            using SKImage scaledImage = SKImage.FromBitmap(scaledBitmap);
            using SKData data = scaledImage.Encode();
            using (var fileStream = System.IO.File.Create(saveFilePath))
            {
                var myStream = data.AsStream();
                myStream.Seek(0, SeekOrigin.Begin);
                myStream.CopyTo(fileStream);
            }
        }
        
        
        

About

ImageResize Work on Ubuntu server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published