You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have verified that I am running the latest version of ImageSharp
I have verified if the problem exist in both DEBUG and RELEASE mode
I have searched open and closed issues to ensure it has not already been reported
Description
Resize an image will lost some pixel.
Steps to Reproduce
btw: _imageData is an image byte array.
publicoverridebyte[]Scale(doublescaleFactor,Stringformat){this.ThrowIfDisposed();if(scaleFactor<=0){thrownewArgumentException("scalefactor must be greate than 0",nameof(scaleFactor));}try{intwidth=(int)(this.Profile.PixelWidth*scaleFactor);intheight=(int)(this.Profile.PixelHeight*scaleFactor);using(Image<Rgba32>bitmap=Image.Load(_imageData,outIImageFormatimageFormat)){bitmap.Mutate(x =>x.Resize(width,height));IImageFormatf=String.IsNullOrWhiteSpace(format)?imageFormat:GetImageFormat(format);using(MemoryStreamstream=newMemoryStream()){bitmap.Save(stream,f);stream.Position=0;returnstream.ToArray();}}}catch(Exceptionex){thrownewImagingException("scale error.",ex);}}privateIImageFormatGetImageFormat(stringformat){IImageFormatimageFormat=SixLabors.ImageSharp.Configuration.Default.FindFormatByFileExtension(format);if(imageFormat==null){thrownewImagingException($"unsupported format:{format}。");}returnimageFormat;}
original Image
got result:
resize to 150px:
resize to 80px
resize to 30px
System Configuration
Visual studio 2017
<TargetFramework>netstandard1.6</TargetFramework>
ImageSharp version: 1.0.0-beta0002
Environment (Operating system, version and so on): Windows 10 x64
.NET Framework version: netstandard1.6
Additional information:
The text was updated successfully, but these errors were encountered:
endink
changed the title
resize image error
resize an image from byte[] to byte[] may lose pixels
Jan 20, 2018
Prerequisites
DEBUG
andRELEASE
modeDescription
Resize an image will lost some pixel.
Steps to Reproduce
btw: _imageData is an image byte array.
original Image
got result:
resize to 150px:

resize to 80px

resize to 30px

System Configuration
Visual studio 2017
The text was updated successfully, but these errors were encountered: