Skip to content

Commit

Permalink
Additional fixes + gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
JimBobSquarePants committed Oct 5, 2021
1 parent e86945e commit 944d8f9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,7 @@ artifacts/
**/Images/ReferenceOutput
**/Images/Input/MemoryStress
.DS_Store

#lfs
hooks/**
lfs/**
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public void SystemDrawingResize(string input)
using var image = SystemDrawingImage.FromFile(input, true);
this.IncreaseTotalMegapixels(image.Width, image.Height);

(int Width, int Height) scaled = this.ScaledSize(image.Width, image.Height, ThumbnailSize);
(int Width, int Height) scaled = this.ScaledSize(image.Width, image.Height, this.ThumbnailSize);
var resized = new Bitmap(scaled.Width, scaled.Height);
using var graphics = Graphics.FromImage(resized);
using var attributes = new ImageAttributes();
Expand Down Expand Up @@ -188,7 +188,7 @@ public void ImageSharpResize(string input)

image.Mutate(i => i.Resize(new ResizeOptions
{
Size = new ImageSharpSize(ThumbnailSize, ThumbnailSize),
Size = new ImageSharpSize(this.ThumbnailSize, this.ThumbnailSize),
Mode = ResizeMode.Max
}));

Expand All @@ -205,7 +205,7 @@ public void MagickResize(string input)
this.IncreaseTotalMegapixels(image.Width, image.Height);

// Resize it to fit a 150x150 square
image.Resize(ThumbnailSize, ThumbnailSize);
image.Resize(this.ThumbnailSize, this.ThumbnailSize);

// Reduce the size of the file
image.Strip();
Expand All @@ -221,8 +221,8 @@ public void MagicScalerResize(string input)
{
var settings = new ProcessImageSettings()
{
Width = ThumbnailSize,
Height = ThumbnailSize,
Width = this.ThumbnailSize,
Height = this.ThumbnailSize,
ResizeMode = CropScaleMode.Max,
SaveFormat = FileFormat.Jpeg,
JpegQuality = Quality,
Expand All @@ -238,7 +238,7 @@ public void SkiaCanvasResize(string input)
{
using var original = SKBitmap.Decode(input);
this.IncreaseTotalMegapixels(original.Width, original.Height);
(int Width, int Height) scaled = this.ScaledSize(original.Width, original.Height, ThumbnailSize);
(int Width, int Height) scaled = this.ScaledSize(original.Width, original.Height, this.ThumbnailSize);
using var surface = SKSurface.Create(new SKImageInfo(scaled.Width, scaled.Height, original.ColorType, original.AlphaType));
using var paint = new SKPaint() { FilterQuality = SKFilterQuality.High };
SKCanvas canvas = surface.Canvas;
Expand All @@ -256,7 +256,7 @@ public void SkiaBitmapResize(string input)
{
using var original = SKBitmap.Decode(input);
this.IncreaseTotalMegapixels(original.Width, original.Height);
(int Width, int Height) scaled = this.ScaledSize(original.Width, original.Height, ThumbnailSize);
(int Width, int Height) scaled = this.ScaledSize(original.Width, original.Height, this.ThumbnailSize);
using var resized = original.Resize(new SKImageInfo(scaled.Width, scaled.Height), SKFilterQuality.High);
if (resized == null)
{
Expand All @@ -272,7 +272,7 @@ public void SkiaBitmapResize(string input)
public void NetVipsResize(string input)
{
// Thumbnail to fit a 150x150 square
using var thumb = NetVipsImage.Thumbnail(input, ThumbnailSize, ThumbnailSize);
using var thumb = NetVipsImage.Thumbnail(input, this.ThumbnailSize, this.ThumbnailSize);

// Save the results
thumb.Jpegsave(this.OutputPath(input, NetVips), q: Quality, strip: true);
Expand Down

0 comments on commit 944d8f9

Please sign in to comment.