diff --git a/.gitignore b/.gitignore
index 21563da177..41f0b3340a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -176,5 +176,5 @@ _site/
**/node_modules
**/node_modules/*
-project.lock.json
-src/ImageProcessor/project.lock.json
\ No newline at end of file
+**/TestOutput
+project.lock.json
\ No newline at end of file
diff --git a/global.json b/global.json
index b0323e4281..c2444082ac 100644
--- a/global.json
+++ b/global.json
@@ -1,3 +1,8 @@
{
- "projects": [ "src" ]
+ "projects": [ "src" ],
+ "sdk": {
+ "version": "1.0.0-beta8",
+ "runtime": "coreclr",
+ "architecture": "x86"
+ }
}
\ No newline at end of file
diff --git a/src/ImageProcessor/Formats/Gif/Quantizer/QuantizedImage.cs b/src/ImageProcessor/Formats/Gif/Quantizer/QuantizedImage.cs
index bddebe5993..6b840fc706 100644
--- a/src/ImageProcessor/Formats/Gif/Quantizer/QuantizedImage.cs
+++ b/src/ImageProcessor/Formats/Gif/Quantizer/QuantizedImage.cs
@@ -69,12 +69,13 @@ namespace ImageProcessor.Formats
Image image = new Image();
int pixelCount = this.Pixels.Length;
+ int palletCount = this.Palette.Length - 1;
float[] bgraPixels = new float[pixelCount * 4];
for (int i = 0; i < pixelCount; i++)
{
int offset = i * 4;
- Bgra32 color = this.Palette[this.Pixels[i]];
+ Bgra32 color = this.Palette[Math.Min(palletCount, this.Pixels[i])];
bgraPixels[offset + 0] = color.B;
bgraPixels[offset + 1] = color.G;
bgraPixels[offset + 2] = color.R;
diff --git a/src/ImageProcessor/project.lock.json.REMOVED.git-id b/src/ImageProcessor/project.lock.json.REMOVED.git-id
index 686b92b42f..9087efb8b8 100644
--- a/src/ImageProcessor/project.lock.json.REMOVED.git-id
+++ b/src/ImageProcessor/project.lock.json.REMOVED.git-id
@@ -1 +1 @@
-b4afca3213a5d2714e409729a1ef2622b62a5bca
\ No newline at end of file
+869b4da8e5d4467a9e8fe7af0413a80080cd8f15
\ No newline at end of file
diff --git a/tests/ImageProcessor.Tests/Colors/ColorConversionTests.cs b/tests/ImageProcessor.Tests/Colors/ColorConversionTests.cs
index 1c286da7b1..0a3945622c 100644
--- a/tests/ImageProcessor.Tests/Colors/ColorConversionTests.cs
+++ b/tests/ImageProcessor.Tests/Colors/ColorConversionTests.cs
@@ -36,23 +36,23 @@ namespace ImageProcessor.Tests
Color color = new Color(1, 1, 1);
YCbCr yCbCr = color;
- Assert.Equal(255, yCbCr.Y);
- Assert.Equal(128, yCbCr.Cb);
- Assert.Equal(128, yCbCr.Cr);
+ Assert.Equal(255, yCbCr.Y, 0);
+ Assert.Equal(128, yCbCr.Cb, 0);
+ Assert.Equal(128, yCbCr.Cr, 0);
// Black
Color color2 = new Color(0, 0, 0);
YCbCr yCbCr2 = color2;
- Assert.Equal(0, yCbCr2.Y);
- Assert.Equal(128, yCbCr2.Cb);
- Assert.Equal(128, yCbCr2.Cr);
+ Assert.Equal(0, yCbCr2.Y, 0);
+ Assert.Equal(128, yCbCr2.Cb, 0);
+ Assert.Equal(128, yCbCr2.Cr, 0);
// Grey
Color color3 = new Color(.5f, .5f, .5f);
YCbCr yCbCr3 = color3;
- Assert.Equal(128, yCbCr3.Y);
- Assert.Equal(128, yCbCr3.Cb);
- Assert.Equal(128, yCbCr3.Cr);
+ Assert.Equal(128, yCbCr3.Y, 0);
+ Assert.Equal(128, yCbCr3.Cb, 0);
+ Assert.Equal(128, yCbCr3.Cr, 0);
}
///
diff --git a/tests/ImageProcessor.Tests/Processors/Formats/EncoderDecoderTests.cs b/tests/ImageProcessor.Tests/Processors/Formats/EncoderDecoderTests.cs
index f9049056ba..8f3b8c453b 100644
--- a/tests/ImageProcessor.Tests/Processors/Formats/EncoderDecoderTests.cs
+++ b/tests/ImageProcessor.Tests/Processors/Formats/EncoderDecoderTests.cs
@@ -12,12 +12,12 @@
[Fact]
public void DecodeThenEncodeImageFromStreamShouldSucceed()
{
- if (!Directory.Exists("Encoded"))
+ if (!Directory.Exists("TestOutput/Encoded"))
{
- Directory.CreateDirectory("Encoded");
+ Directory.CreateDirectory("TestOutput/Encoded");
}
- foreach (FileInfo file in new DirectoryInfo("Encoded").GetFiles())
+ foreach (FileInfo file in new DirectoryInfo("TestOutput/Encoded").GetFiles())
{
file.Delete();
}
@@ -29,7 +29,7 @@
Stopwatch watch = Stopwatch.StartNew();
Image image = new Image(stream);
- string encodedFilename = "Encoded/" + Path.GetFileName(file);
+ string encodedFilename = "TestOutput/Encoded/" + Path.GetFileName(file);
using (FileStream output = File.OpenWrite(encodedFilename))
{
diff --git a/tests/ImageProcessor.Tests/Processors/ProcessorTestBase.cs b/tests/ImageProcessor.Tests/Processors/ProcessorTestBase.cs
index 059a94a3e7..1bc117e541 100644
--- a/tests/ImageProcessor.Tests/Processors/ProcessorTestBase.cs
+++ b/tests/ImageProcessor.Tests/Processors/ProcessorTestBase.cs
@@ -19,25 +19,25 @@ namespace ImageProcessor.Tests
///
public static readonly List Files = new List
{
- //"../../TestImages/Formats/Jpg/Backdrop.jpg",
- //"../../TestImages/Formats/Jpg/Calliphora.jpg",
+ //"TestImages/Formats/Jpg/Backdrop.jpg",
+ //"TestImages/Formats/Jpg/Calliphora.jpg",
"TestImages/Formats/Jpg/china.jpg",
- //"../../TestImages/Formats/Jpg/ant.jpg",
- //"../../TestImages/Formats/Jpg/parachute.jpg",
- //"../../TestImages/Formats/Jpg/lomo.jpg",
- //"../../TestImages/Formats/Jpg/shaftesbury.jpg",
- //"../../TestImages/Formats/Jpg/gamma_dalai_lama_gray.jpg",
- //"../../TestImages/Formats/Jpg/greyscale.jpg",
- //"../../TestImages/Formats/Bmp/Car.bmp",
+ //"TestImages/Formats/Jpg/ant.jpg",
+ //"TestImages/Formats/Jpg/parachute.jpg",
+ //"TestImages/Formats/Jpg/lomo.jpg",
+ //"TestImages/Formats/Jpg/shaftesbury.jpg",
+ //"TestImages/Formats/Jpg/gamma_dalai_lama_gray.jpg",
+ //"TestImages/Formats/Jpg/greyscale.jpg",
+ //"TestImages/Formats/Bmp/Car.bmp",
"TestImages/Formats/Png/cballs.png",
- //"../../TestImages/Formats/Png/cmyk.png",
- //"../../TestImages/Formats/Png/gamma-1.0-or-2.2.png",
+ //"TestImages/Formats/Png/cmyk.png",
+ //"TestImages/Formats/Png/gamma-1.0-or-2.2.png",
"TestImages/Formats/Png/splash.png",
- //"../../TestImages/Formats/Gif/leaf.gif",
- //"../../TestImages/Formats/Gif/ben2.gif",
- //"../../TestImages/Formats/Gif/rings.gif",
- //"../../TestImages/Formats/Gif/ani2.gif",
- //"../../TestImages/Formats/Gif/giphy.gif"
+ "TestImages/Formats/Gif/leaf.gif",
+ //"TestImages/Formats/Gif/ben2.gif",
+ //"TestImages/Formats/Gif/rings.gif",
+ //"TestImages/Formats/Gif/ani2.gif",
+ //"TestImages/Formats/Gif/giphy.gif"
};
}
}
diff --git a/tests/ImageProcessor.Tests/Processors/Samplers/SamplerTests.cs b/tests/ImageProcessor.Tests/Processors/Samplers/SamplerTests.cs
index a507c5a507..e171341f8b 100644
--- a/tests/ImageProcessor.Tests/Processors/Samplers/SamplerTests.cs
+++ b/tests/ImageProcessor.Tests/Processors/Samplers/SamplerTests.cs
@@ -32,9 +32,9 @@ namespace ImageProcessor.Tests
[MemberData("Samplers")]
public void ImageShouldResize(string name, IResampler sampler)
{
- if (!Directory.Exists("Resized"))
+ if (!Directory.Exists("TestOutput/Resized"))
{
- Directory.CreateDirectory("Resized");
+ Directory.CreateDirectory("TestOutput/Resized");
}
foreach (string file in Files)
@@ -44,7 +44,7 @@ namespace ImageProcessor.Tests
Stopwatch watch = Stopwatch.StartNew();
Image image = new Image(stream);
string filename = Path.GetFileNameWithoutExtension(file) + "-" + name + Path.GetExtension(file);
- using (FileStream output = File.OpenWrite($"Resized/{filename}"))
+ using (FileStream output = File.OpenWrite($"TestOutput/Resized/{filename}"))
{
image.Resize(image.Width / 2, image.Height / 2, sampler).Save(output);
}
@@ -57,9 +57,9 @@ namespace ImageProcessor.Tests
[Fact]
public void ImageShouldCrop()
{
- if (!Directory.Exists("Cropped"))
+ if (!Directory.Exists("TestOutput/Cropped"))
{
- Directory.CreateDirectory("Cropped");
+ Directory.CreateDirectory("TestOutput/Cropped");
}
foreach (string file in Files)
@@ -68,7 +68,7 @@ namespace ImageProcessor.Tests
{
Image image = new Image(stream);
string filename = Path.GetFileNameWithoutExtension(file) + "-Cropped" + Path.GetExtension(file);
- using (FileStream output = File.OpenWrite($"Cropped/{filename}"))
+ using (FileStream output = File.OpenWrite($"TestOutput/Cropped/{filename}"))
{
image.Crop(image.Width / 2, image.Height / 2).Save(output);
}
diff --git a/tests/ImageProcessor.Tests/project.json b/tests/ImageProcessor.Tests/project.json
index 2d57c937ad..ed1af75222 100644
--- a/tests/ImageProcessor.Tests/project.json
+++ b/tests/ImageProcessor.Tests/project.json
@@ -20,8 +20,8 @@
"ImageProcessor": "3.0.0-*",
"Microsoft.NETCore": "5.0.1-beta-23409",
"Microsoft.NETCore.Platforms": "1.0.1-beta-23409",
- "xunit": "2.1.0",
- "xunit.runner.dnx": "2.1.0-beta6-build191"
+ "xunit": "2.1.0-*",
+ "xunit.runner.dnx": "2.1.0-*"
},
"commands": {
"test": "xunit.runner.dnx"
diff --git a/tests/ImageProcessor.Tests/project.lock.json.REMOVED.git-id b/tests/ImageProcessor.Tests/project.lock.json.REMOVED.git-id
index 516e705420..fe827e716d 100644
--- a/tests/ImageProcessor.Tests/project.lock.json.REMOVED.git-id
+++ b/tests/ImageProcessor.Tests/project.lock.json.REMOVED.git-id
@@ -1 +1 @@
-986564cced9c1356c73f345d4f605395896bf156
\ No newline at end of file
+e6a19da5fae2d14f8371b848e58732e830f6e7d7
\ No newline at end of file