Browse Source

Fix gamma

Former-commit-id: a837a9defa7b376e9654b078899aa12359155633
Former-commit-id: 88e2563e726d1c66855b4ff38fb8db897d666893
af/merge-core
James South 11 years ago
parent
commit
741a580970
  1. 34
      src/ImageProcessor.Playground/Program.cs
  2. 1
      src/ImageProcessor.Playground/images/input/Calliphora_sp_Portrait.jpg.REMOVED.git-id
  3. 3
      src/ImageProcessor.Playground/images/input/PIA11667_modest.jpg
  4. 3
      src/ImageProcessor.Playground/images/input/blur-test.jpg
  5. 3
      src/ImageProcessor.Playground/images/input/blur-test.png
  6. 3
      src/ImageProcessor.Playground/images/input/gamma-1.0-or-2.2.png
  7. 3
      src/ImageProcessor.Playground/images/input/gamma_3x3.jpg
  8. 3
      src/ImageProcessor.Playground/images/input/gamma_colors.jpg
  9. 1
      src/ImageProcessor.Playground/images/input/gamma_dalai_lama_gray.jpg.REMOVED.git-id
  10. 3
      src/ImageProcessor.Playground/images/input/gamma_rainbow.jpg
  11. 2
      src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs
  12. 2
      src/ImageProcessor.Web/Processors/Resize.cs
  13. 62
      src/ImageProcessor/ImageFactory.cs
  14. 1
      src/ImageProcessor/ImageProcessor.csproj
  15. 9
      src/ImageProcessor/Imaging/Convolution.cs
  16. 45
      src/ImageProcessor/Imaging/Helpers/Adjustments.cs
  17. 9
      src/ImageProcessor/Imaging/Quantizers/OctreeQuantizer.cs
  18. 90
      src/ImageProcessor/Processors/Gamma.cs
  19. 2
      src/ImageProcessor/Processors/Resize.cs
  20. 210
      src/TestWebsites/MVC/Views/Home/Index.cshtml
  21. 8
      src/TestWebsites/MVC/Web.config
  22. 3
      src/TestWebsites/MVC/config/imageprocessor/security.config

34
src/ImageProcessor.Playground/Program.cs

@ -54,20 +54,25 @@ namespace ImageProcessor.PlayGround
//FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "2008.jpg"));
//FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "stretched.jpg"));
//FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "mountain.jpg"));
FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "blur-test.png"));
//FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "gamma-1.0-or-2.2.png"));
//FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "gamma_dalai_lama_gray.jpg"));
//FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "Arc-de-Triomphe-France.jpg"));
//FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "Martin-Schoeller-Jack-Nicholson-Portrait.jpeg"));
//FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "crop-base-300x200.jpg"));
////FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "crop-base-300x200.jpg"));
//FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "cmyk.png"));
//IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".gif");
IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".jpg", ".jpeg", ".jfif");
//IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".png");
//IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".jpg", ".jpeg", ".jfif");
//IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".gif", ".webp", ".bmp", ".jpg", ".png", ".tif");
foreach (FileInfo fileInfo in files)
{
if (fileInfo.Name == "test5.jpg")
{
continue;
}
//foreach (FileInfo fileInfo in files)
//{
// if (fileInfo.Name == "test5.jpg")
// {
// continue;
// }
byte[] photoBytes = File.ReadAllBytes(fileInfo.FullName);
Console.WriteLine("Processing: " + fileInfo.Name);
@ -78,9 +83,9 @@ namespace ImageProcessor.PlayGround
// ImageProcessor
using (MemoryStream inStream = new MemoryStream(photoBytes))
{
using (ImageFactory imageFactory = new ImageFactory(true))
using (ImageFactory imageFactory = new ImageFactory(true, true))
{
Size size = new Size(1024, 0);
Size size = new Size(500, 0);
CropLayer cropLayer = new CropLayer(20, 20, 20, 20, ImageProcessor.Imaging.CropMode.Percentage);
//ResizeLayer layer = new ResizeLayer(size, ResizeMode.Max, AnchorPosition.Center, false);
@ -109,10 +114,11 @@ namespace ImageProcessor.PlayGround
// .Resize(new ResizeLayer(size, ResizeMode.Stretch))
//.DetectEdges(new Laplacian3X3EdgeFilter(), true)
//.DetectEdges(new LaplacianOfGaussianEdgeFilter())
.GaussianBlur(new GaussianLayer(10, 11))
//.EntropyCrop()
//.Halftone(true)
//.Halftone(false)
//.RotateBounded(150, false)
.Crop(cropLayer)
//.Crop(cropLayer)
//.Rotate(140)
//.Filter(MatrixFilters.Invert)
//.Contrast(50)
@ -124,7 +130,7 @@ namespace ImageProcessor.PlayGround
//.Format(new PngFormat() { IsIndexed = true })
//.Format(new PngFormat() )
.Save(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(path), @"..\..\images\output", fileInfo.Name)));
//.Save(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(path), @"..\..\images\output", Path.GetFileNameWithoutExtension(fileInfo.Name) + ".png")));
//.Save(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(path), @"..\..\images\output", Path.GetFileNameWithoutExtension(fileInfo.Name) + ".png")));
stopwatch.Stop();
}
@ -136,7 +142,7 @@ namespace ImageProcessor.PlayGround
Console.WriteLine(@"Completed {0} in {1:s\.fff} secs {2}Peak memory usage was {3} bytes or {4} Mb.", fileInfo.Name, stopwatch.Elapsed, Environment.NewLine, peakWorkingSet64.ToString("#,#"), mB);
//Console.WriteLine("Processed: " + fileInfo.Name + " in " + stopwatch.ElapsedMilliseconds + "ms");
}
//}
Console.ReadLine();
}

1
src/ImageProcessor.Playground/images/input/Calliphora_sp_Portrait.jpg.REMOVED.git-id

@ -0,0 +1 @@
5d446f64d0636f6ad7e9f82625eeff89ef394fe2

3
src/ImageProcessor.Playground/images/input/PIA11667_modest.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:791e93fab90cd16561f33bb5a69d74ded08f828939d74cd3693ec23a629dd6e5
size 12354

3
src/ImageProcessor.Playground/images/input/blur-test.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:35e2ad14d4315b2d52b5022741420214614afc9a6c781e784d6c8644f07c44ef
size 10879

3
src/ImageProcessor.Playground/images/input/blur-test.png

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:08a4072d090b489c23aac01e05a2d1a758db76ed7706c0655686810721aa148c
size 3563

3
src/ImageProcessor.Playground/images/input/gamma-1.0-or-2.2.png

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:01a558cd936c4972954baaa163d4cb584fbf52133e5287fff5f8d74402107b46
size 4195

3
src/ImageProcessor.Playground/images/input/gamma_3x3.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c7ba67fed963f782895f8450a5657ab8aa9f53136214d52bb93adc2b1cf823ab
size 29596

3
src/ImageProcessor.Playground/images/input/gamma_colors.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7f21bb17e7a751d186e3065316ff1768824e43d98ecc419b0a0ecec08dd96a9c
size 15109

1
src/ImageProcessor.Playground/images/input/gamma_dalai_lama_gray.jpg.REMOVED.git-id

@ -0,0 +1 @@
56cbc3371def2882d1ead5d4d2456550f2b8d72c

3
src/ImageProcessor.Playground/images/input/gamma_rainbow.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:234449776aad96cc39160a4fbe2f76cecdfa9412f92358c16a4e36d6ea7f9e4c
size 47557

2
src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs

@ -340,7 +340,7 @@ namespace ImageProcessor.Web.HttpModules
else
{
// Parse any protocol values from settings.
string protocol = currentService.Settings["Protocol"] != null
string protocol = currentService.Settings.ContainsKey("Protocol")
? currentService.Settings["Protocol"] + "://"
: string.Empty;

2
src/ImageProcessor.Web/Processors/Resize.cs

@ -115,7 +115,7 @@ namespace ImageProcessor.Web.Processors
// TODO: This is hacky and awful and should go.
if (match.Value.ToUpperInvariant().Contains("CARVE") || match.Value.ToUpperInvariant().Contains("PERCENT"))
{
break;
continue;
}
if (index == 0)

62
src/ImageProcessor/ImageFactory.cs

@ -63,10 +63,14 @@ namespace ImageProcessor
/// <param name="preserveExifData">
/// Whether to preserve exif metadata. Defaults to false.
/// </param>
public ImageFactory(bool preserveExifData = false)
/// <param name="fixGamma">
/// Whether to fix the gamma component of the image. Defaults to true.
/// </param>
public ImageFactory(bool preserveExifData = false, bool fixGamma = true)
{
this.PreserveExifData = preserveExifData;
this.ExifPropertyItems = new ConcurrentDictionary<int, PropertyItem>();
this.FixGamma = fixGamma;
}
#endregion
@ -111,6 +115,11 @@ namespace ImageProcessor
/// </summary>
public bool PreserveExifData { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to fix the gamma component of the current image.
/// </summary>
public bool FixGamma { get; set; }
/// <summary>
/// Gets or sets the exif property items.
/// </summary>
@ -179,6 +188,12 @@ namespace ImageProcessor
this.ShouldProcess = true;
// Normalize the gamma component of the image.
if (this.FixGamma)
{
this.Gamma(2.2F);
}
return this;
}
@ -233,6 +248,12 @@ namespace ImageProcessor
}
this.ShouldProcess = true;
// Normalize the gamma component of the image.
if (this.FixGamma)
{
this.Gamma(2.2F);
}
}
}
else
@ -560,6 +581,32 @@ namespace ImageProcessor
return this;
}
/// <summary>
/// Adjust the gamma (intensity of the light) component of the given image.
/// </summary>
/// <param name="value">
/// The value to adjust the gamma by (typically between .2 and 5).
/// </param>
/// <returns>
/// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
/// </returns>
public ImageFactory Gamma(float value)
{
if (this.ShouldProcess)
{
// Sanitize the input.
if (value > 5 || value < .1)
{
value = 2.2F;
}
Gamma gamma = new Gamma { DynamicParameter = value };
this.CurrentImageFormat.ApplyProcessor(gamma.ProcessImage, this);
}
return this;
}
/// <summary>
/// Uses a Gaussian kernel to blur the current image.
/// <remarks>
@ -1091,6 +1138,12 @@ namespace ImageProcessor
directoryInfo.Create();
}
// Normalize the gamma component of the image.
if (this.FixGamma)
{
this.Gamma(1 / 2.2F);
}
this.Image = this.CurrentImageFormat.Save(filePath, this.Image);
}
@ -1112,6 +1165,13 @@ namespace ImageProcessor
{
// Allow the same stream to be used as for input.
stream.SetLength(0);
// Normalize the gamma component of the image.
if (this.FixGamma)
{
this.Gamma(1 / 2.2F);
}
this.Image = this.CurrentImageFormat.Save(stream, this.Image);
stream.Position = 0;
}

1
src/ImageProcessor/ImageProcessor.csproj

@ -216,6 +216,7 @@
<Compile Include="Imaging\Resizer.cs" />
<Compile Include="Imaging\RoundedCornerLayer.cs" />
<Compile Include="Imaging\TextLayer.cs" />
<Compile Include="Processors\Gamma.cs" />
<Compile Include="Processors\Alpha.cs" />
<Compile Include="Processors\EntropyCrop.cs" />
<Compile Include="Processors\BackgroundColor.cs" />

9
src/ImageProcessor/Imaging/Convolution.cs

@ -335,6 +335,10 @@ namespace ImageProcessor.Imaging
green += k * color.G;
blue += k * color.B;
alpha += k * color.A;
//red += k * (color.R * color.R);
//green += k * (color.G * color.G);
//blue += k * (color.B * color.B);
//alpha += k * (color.A * color.A);
processedKernelSize++;
}
@ -360,6 +364,11 @@ namespace ImageProcessor.Imaging
// Check and apply the divider
if ((long)divider != 0)
{
//red = Math.Sqrt(red / divider);
//green = Math.Sqrt(green / divider);
//blue = Math.Sqrt(blue / divider);
//alpha = Math.Sqrt(alpha / divider);
red /= divider;
green /= divider;
blue /= divider;

45
src/ImageProcessor/Imaging/Helpers/Adjustments.cs

@ -15,6 +15,8 @@ namespace ImageProcessor.Imaging.Helpers
using System.Drawing.Imaging;
using System.Threading.Tasks;
using ImageProcessor.Common.Extensions;
/// <summary>
/// Provides reusable adjustment methods to apply to images.
/// </summary>
@ -144,7 +146,7 @@ namespace ImageProcessor.Imaging.Helpers
throw new ArgumentOutOfRangeException("threshold", "Threshold should be between -100 and 100.");
}
Rectangle bounds = rectangle.HasValue ? rectangle.Value : new Rectangle(0, 0, source.Width, source.Height);
Rectangle bounds = rectangle ?? new Rectangle(0, 0, source.Width, source.Height);
float contrastFactor = (float)threshold / 100;
@ -174,5 +176,46 @@ namespace ImageProcessor.Imaging.Helpers
return (Bitmap)source;
}
/// <summary>
/// Adjust the gamma (intensity of the light) component of the given image.
/// </summary>
/// <param name="source">
/// The <see cref="Image"/> source to adjust.
/// </param>
/// <param name="value">
/// The value to adjust the gamma by (typically between .2 and 5).
/// </param>
/// <returns>
/// The <see cref="Bitmap"/> with the gamma adjusted.
/// </returns>
/// <exception cref="ArgumentOutOfRangeException">
/// Thrown if the value falls outside the acceptable range.
/// </exception>
public static Bitmap Gamma(Image source, float value)
{
if (value > 5 || value < .1)
{
throw new ArgumentOutOfRangeException("value", "Value should be between .1 and 5.");
}
int width = source.Width;
int height = source.Height;
Bitmap destination = new Bitmap(width, height);
destination.SetResolution(source.HorizontalResolution, source.VerticalResolution);
Rectangle rectangle = new Rectangle(0, 0, width, height);
using (Graphics graphics = Graphics.FromImage(destination))
{
using (ImageAttributes attributes = new ImageAttributes())
{
attributes.SetGamma(value);
graphics.DrawImage(source, rectangle, 0, 0, width, height, GraphicsUnit.Pixel, attributes);
}
}
source.Dispose();
return destination;
}
}
}

9
src/ImageProcessor/Imaging/Quantizers/OctreeQuantizer.cs

@ -16,6 +16,7 @@ namespace ImageProcessor.Imaging.Quantizers
using System.Drawing;
using System.Drawing.Imaging;
using ImageProcessor.Common.Extensions;
using ImageProcessor.Imaging.Colors;
/// <summary>
@ -505,9 +506,15 @@ namespace ImageProcessor.Imaging.Quantizers
{
// Consume the next palette index
this.paletteIndex = index++;
//int r = Math.Abs(this.red / this.pixelCount);
//int g = Math.Abs(this.green / this.pixelCount);
//int b = Math.Abs(this.blue / this.pixelCount);
int r = (this.red / this.pixelCount).ToByte();
int g = (this.green / this.pixelCount).ToByte();
int b = (this.blue / this.pixelCount).ToByte();
// And set the color of the palette entry
palette.Add(Color.FromArgb(this.red / this.pixelCount, this.green / this.pixelCount, this.blue / this.pixelCount));
palette.Add(Color.FromArgb(r, g, b));
}
else
{

90
src/ImageProcessor/Processors/Gamma.cs

@ -0,0 +1,90 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Gamma.cs" company="James South">
// Copyright (c) James South.
// Licensed under the Apache License, Version 2.0.
// </copyright>
// <summary>
// Encapsulates methods to change the alpha component of the image to effect its luminance.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace ImageProcessor.Processors
{
using System;
using System.Collections.Generic;
using System.Drawing;
using ImageProcessor.Common.Exceptions;
using ImageProcessor.Imaging.Helpers;
/// <summary>
/// Encapsulates methods to change the gamma component of the image to effect its luminance.
/// </summary>
public class Gamma : IGraphicsProcessor
{
/// <summary>
/// Initializes a new instance of the <see cref="Gamma"/> class.
/// </summary>
public Gamma()
{
this.Settings = new Dictionary<string, string>();
}
/// <summary>
/// Gets or sets the dynamic parameter.
/// </summary>
public dynamic DynamicParameter
{
get;
set;
}
/// <summary>
/// Gets or sets any additional settings required by the processor.
/// </summary>
public Dictionary<string, string> Settings
{
get;
set;
}
/// <summary>
/// Processes the image.
/// </summary>
/// <param name="factory">
/// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class containing
/// the image to process.
/// </param>
/// <returns>
/// The processed image from the current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
/// </returns>
public Image ProcessImage(ImageFactory factory)
{
Bitmap newImage = null;
Image image = factory.Image;
try
{
float value = this.DynamicParameter;
newImage = new Bitmap(image);
newImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
newImage = Adjustments.Gamma(newImage, value);
image.Dispose();
image = newImage;
}
catch (Exception ex)
{
if (newImage != null)
{
newImage.Dispose();
}
throw new ImageProcessingException("Error processing image with " + this.GetType().Name, ex);
}
return image;
}
}
}

2
src/ImageProcessor/Processors/Resize.cs

@ -112,4 +112,4 @@ namespace ImageProcessor.Processors
return image;
}
}
}
}

210
src/TestWebsites/MVC/Views/Home/Index.cshtml

@ -7,213 +7,23 @@
<div class="row">
<div class="col-s-6">
<h2>Resized</h2>
<img src="/images/format-Penguins.jpg?width=302" />
<img src="/remote.axd/ipcache.blob.core.windows.net/source/IMG_0671.JPG?width=302&filter=comic" />
<img src="/images/format-Penguins.jpg?width=400&height=500&anchor=top" />
<img src="/images/format-Penguins.jpg?width=400&rotatebounded=45" />
<img src="/images/format-Penguins.jpg?width=400&rotatebounded=45&rotatebounded.keepsize=true" />
<img src="/remote.axd/ciras.blob.core.windows.net/media-test/1002/happy-young-businessman_big.jpg?crop=0.24671916010498687,0.029791962724296239,0,0.32968083870333464&cropmode=percentage&quality=90&width=480&heightratio=0.7491289198606271777003484321&slimmage=true"/>
</div>
<div class="col-s-6">
<h2>Cropped </h2>
<img src="/images/format-Penguins.jpg?crop=0,0,300,225" />
<h3>Cropped Percent</h3>
<img src="/images/format-Penguins.jpg?width=300&height300&crop=0.1,0.2,0.1,0.6&cropmode=percent" />
<img src="/images/bus.jpg?width=311" />
<h2>Resized Remote</h2>
<img src="/remote.axd/ipcache.blob.core.windows.net/source/IMG_0671.JPG?width=400" />
</div>
</div>
</section>
<section>
<div class="row">
<h2>Reside Pad</h2>
<div class="col-s-4">
<img src="/images/format-Penguins.jpg?width=300&height=500" />
<div class="col-s-6">
<h2>Resized Remote</h2>
<img src="/remote.axd/ipcache.blob.core.windows.net/source/IMG_1188.JPG?width=400&halftone=comic" />
</div>
</div>
</section>
@*<section>
<div class="row">
<h2>Resize Crop</h2>
<div class="col-s-4">
<img src="/images/format-Penguins.jpg?width=300&height=500&mode=crop" />
</div>
<div class="col-s-8">
<img src="/images/udendørs.jpg?width=600&height=250&mode=crop" />
<img src="/images/bus.jpg?width=311&height=250&mode=crop&center=0.2,0.7" />
</div>
</div>
</section>
<section>
<div class="row">
<h2>Resize Max</h2>
<div class="col-s-4">
<img src="/images/format-Penguins.jpg?width=300&height=500&mode=max" />
</div>
<div class="col-s-8">
<img src="/images/udendørs.jpg?width=600&height=250&mode=max" />
</div>
</div>
</section>
<section>
<div class="row">
<h2>Resize Max - No Upscale</h2>
<div class="col-s-4">
<img src="/images/format-Penguins-200.jpg?width=300&height=500&mode=max&upscale=false" />
</div>
<div class="col-s-8">
<img src="/images/udendørs-374.jpg?width=600&height=250&mode=max&upscale=false" />
</div>
</div>
</section>
<section>
<div class="row">
<h2>Resize Stretch</h2>
<div class="col-s-4">
<img src="/images/format-Penguins.jpg?width=300&height=500&mode=stretch" />
</div>
<div class="col-s-8">
<img src="/images/udendørs.jpg?width=600&height=250&mode=stretch" />
</div>
</div>
</section>
<section>
<h2>Filter</h2>
<div class="row">
<div class="col-s-6">
<h3>blackwhite</h3>
<img src="/images/format-Penguins.jpg?width=300&filter=blackwhite" />
</div>
<div class="col-s-6">
<h3>comic</h3>
<img src="/images/format-Penguins.jpg?width=300&filter=comic" />
</div>
</div>
<div class="row">
<div class="col-s-6">
<h3>lomograph</h3>
<img src="/images/format-Penguins.jpg?width=300&filter=lomograph" />
</div>
<div class="col-s-6">
<h3>greyscale</h3>
<img src="/images/format-Penguins.jpg?width=300&filter=greyscale" />
</div>
</div>
<div class="row">
<div class="col-s-6">
<h3>polaroid</h3>
<img src="/images/format-Penguins.jpg?width=300&filter=polaroid" />
</div>
<div class="col-s-6">
<h3>sepia</h3>
<img src="/images/format-Penguins.jpg?width=300&filter=sepia" />
</div>
</div>
<div class="row">
<div class="col-s-6">
<h3>gotham</h3>
<img src="/images/format-Penguins.jpg?width=300&filter=gotham" />
</div>
<div class="col-s-6">
<h3>hisatch</h3>
<img src="/images/format-Penguins.jpg?width=300&filter=hisatch" />
</div>
</div>
<div class="row">
<div class="col-s-6">
<h3>losatch</h3>
<img src="/images/format-Penguins.jpg?width=300&filter=losatch" />
</div>
</div>
</section>
<section>
<div class="row">
<div class="col-s-6">
<h2>Watermark</h2>
<img src="/images/format-Penguins.jpg?width=300&watermark=text-This+is+a+long+body+of+copy+that+should+wrap|color-fff|size-24|style-italic|opacity-100|position-100-100|shadow-true|font-arial" />
</div>
<div class="col-s-6">
<h2>Format</h2>
<img src="/images/format-Penguins.jpg?width=300&format=gif" />
</div>
</div>
</section>
<section>
<div class="row">
<div class="col-s-6">
<h2>Rotate</h2>
<img src="/images/format-Penguins.jpg?width=300&rotate=angle-54,bgcolor-fff" />
</div>
<div class="col-s-6">
<h2>Quality</h2>
<img src="/images/format-Penguins.jpg?width=300&quality=5" />
</div>
</div>
</section>
<section>
<div class="row">
<div class="col-s-6">
<h2>Alpha</h2>
<img src="/images/format-Penguins.jpg?width=300&format=png&alpha=50" />
</div>
<div class="col-s-6">
<h2>Remote</h2>
</div>
</div>
</section>
<section>
<div class="row">
<div class="col-s-6">
<h2>Flip - horizontal</h2>
<img src="/images/format-Penguins.jpg?width=300&flip=horizontal" />
</div>
<div class="col-s-6">
<h2>Flip - vertical</h2>
<img src="/images/format-Penguins.jpg?width=300&flip=vertical" />
</div>
</div>
</section>
<section>
<div class="row">
<div class="col-s-6">
<h2>Gaussian Blur</h2>
<img src="/images/format-Penguins.jpg?width=300&blur=11,sigma-1.5,threshold-10" />
</div>
<div class="col-s-6">
<h2>Gaussian Sharpen</h2>
<img src="/images/format-Penguins.jpg?width=300&sharpen=11,sigma-1.5,threshold-10" />
</div>
</div>
</section>
<section>
<div class="row">
<div class="col-s-6">
<h2>Tint rgba</h2>
<img src="/images/format-Penguins.jpg?width=300&tint=175,118,166,255" />
</div>
<div class="col-s-6">
<h2>Tint Hex</h2>
<img src="/images/format-Penguins.jpg?width=300&tint=af76a6" />
</div>
</div>
</section>*@
</article>
@*<article>
<h1>Color Profiles</h1>
<section>
<div class="row">
<div class="col-s-6">
<h2>CMYK resized jpg</h2>
<img src="/images/cmyk.jpg?width=400" />
</div>
<div class="col-s-6">
<h2>sRGB resized jpg</h2>
<img src="/images/srgb.jpg?width=400" />
</div>
</div>
</section>
<section>
<div class="row">
<h2>Rounding</h2>
<img src="/Images/header_1.jpg?crop=0-43-683-200&width=750&height=220" />
<img src="/Images/header_1.jpg?width=750&crop=0-48-750-220" />
</div>
</section>
</article>*@
</article>

8
src/TestWebsites/MVC/Web.config

@ -6,17 +6,17 @@
<configuration>
<configSections>
<!--<sectionGroup name="imageProcessor">
<sectionGroup name="imageProcessor">
<section name="security" requirePermission="false" type="ImageProcessor.Web.Configuration.ImageSecuritySection, ImageProcessor.Web" />
<section name="processing" requirePermission="false" type="ImageProcessor.Web.Configuration.ImageProcessingSection, ImageProcessor.Web" />
<section name="caching" requirePermission="false" type="ImageProcessor.Web.Configuration.ImageCacheSection, ImageProcessor.Web" />
</sectionGroup>-->
</sectionGroup>
</configSections>
<!--<imageProcessor>
<imageProcessor>
<security configSource="config\imageprocessor\security.config" />
<caching configSource="config\imageprocessor\cache.config" />
<processing configSource="config\imageprocessor\processing.config" />
</imageProcessor>-->
</imageProcessor>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" />

3
src/TestWebsites/MVC/config/imageprocessor/security.config

@ -4,13 +4,14 @@
<service name="LocalFileImageService" type="ImageProcessor.Web.Services.LocalFileImageService, ImageProcessor.Web"/>
<service prefix="remote.axd" name="RemoteImageService" type="ImageProcessor.Web.Services.RemoteImageService, ImageProcessor.Web">
<settings>
<setting key="MaxBytes" value="4194304"/>
<setting key="MaxBytes" value="8194304"/>
<setting key="Timeout" value="30000"/>
<setting key="Protocol" value="http"/>
</settings>
<whitelist>
<add url="http://ipcache.blob.core.windows.net/"/>
<add url="images.mymovies.net"/>
<add url="core.windows.net"/>
<add url="http://maps.googleapis.com"/>
<add url="fbcdn"/>
<add url="http://fbcdn-profile-"/>

Loading…
Cancel
Save