-
Rate limit · GitHub Whoa there!
You have triggered an abuse detection mechanism.
Please wait a few minutes before you try again;
in some cases this may take up to an hour. -
Notifications
You must be signed in to change notification settings - Fork 857
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Former-commit-id: e120f457ff05251ec312fc546e70ac3b09febbe9
Whoa there!
You have triggered an abuse detection mechanism.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.
1 parent
dd5d2f6
commit ef21a55
Showing
49 changed files
with
1,630 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/input/2006-citybus.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
7f6786517fa67c9dfccac831e8491e4d08866d24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
7eb554b7681119b1170b70f1c1c2fc0de28a60ac |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/input/2012-citybus.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8d39e89104598b85035a2c29592b847edcfdb8ac |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/input/Arc-de-Triomphe-France.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ff6cd6bf1cd388e8933071ec36880c33d1bc08f2 |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/input/Image with gaps.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
68e14cae5c31c58b8b66d26bca6eb67c79ecd203 |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/input/arc_de_triomphe_paris_france.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
c679b986c1ccbd9f6f8d72d7e4717f380b923a75 |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/input/monster.png.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
6b1252209f60025427722f765dbbc271d125114e |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/input/mountain.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
66b1f9f5ef7ca628ca4a44de9188e11e4af17229 |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/input/night-bridge.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
414f5a48bd8d020beae85c2dee480cb5d22ec9b7 |
1 change: 1 addition & 0 deletions
1
...ssorConsole/images/input/shutterstock_19173982_Arc_de_triomphe-square1.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a2cccdee0f806b2d41bfcdbb2dc9a1fe3d8656c6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
99704952050f56a69f591220bb9f0f2014215c7f |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/input/tower.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
98c3f8fce4fdd9eebafe12431c8e014fd39d243f |
2 changes: 1 addition & 1 deletion
2
src/ImageProcessorConsole/images/output/120430.gif.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
30ec5c05548fd350f9b7c699715848b9fbfb8ca9 | ||
e41022eb5fe724ba5fe2b7aeda29a1f4b6878484 |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/output/2006-citybus.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
33f7e25da5675197f18bb2fa2c9fe5fa366e84ec |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/output/2008.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
f24f17627804b11d823240d49c91ec17fb7fd55d |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/output/2012-citybus.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
def19dd7469cf2eba1f595e7263d9d48fda85825 |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/output/Arc-de-Triomphe-France.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
8cf61b55acca1a3d1a69177ddc439685ee0ba192 |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/output/Image with gaps.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
629284a6f834f5d1cf185e3603a50c484dd9121a |
2 changes: 1 addition & 1 deletion
2
src/ImageProcessorConsole/images/output/Tl4Yb.gif.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
fdc62fc2d056ab885eb9e8fd12b9155ee86d7c43 | ||
f5681324d193a42492647f4952057c2b72026096 |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/output/arc_de_triomphe_paris_france.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3d652e0628f2042e7aca0751384ba21f1182ef5f |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/output/monster.png.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
d8d3354b684cad79d9a46f92ed3a58747a808ad1 |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/output/mountain.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1c48519b2675b9dd90e8e95d6421148b25b8c317 |
2 changes: 1 addition & 1 deletion
2
src/ImageProcessorConsole/images/output/nLpfllv.gif.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
23a1c81a2d1422076373796e0c47f5d968c56d0b | ||
b65d9e937cad7ddd02ff0d01a3be2f09c55e63e8 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/output/rotate.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
a0aa8338f74f3539c2531f43fa9027a3ce0a39fb |
1 change: 1 addition & 0 deletions
1
...sorConsole/images/output/shutterstock_19173982_Arc_de_triomphe-square1.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
04f6093d3345a4c8b48333c32972753dd0949730 |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/output/test.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
f7b1543810ada7598773d6ee31bc7c0c20afaa9f |
1 change: 1 addition & 0 deletions
1
src/ImageProcessorConsole/images/output/tower.jpg.REMOVED.git-id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2d5b165c27545a3860d8a6b35f8ac4438f57593a |
109 changes: 109 additions & 0 deletions
109
src/Plugins/ImageProcessor/ImageProcessor.Plugins.Cair/CairBootstrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="CairBootstrapper.cs" company="James South"> | ||
// Copyright (c) James South. | ||
// Licensed under the Apache License, Version 2.0. | ||
// </copyright> | ||
// <summary> | ||
// Defines the CairBootstrapper type. | ||
// </summary> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace ImageProcessor.Plugins.Cair | ||
{ | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
|
||
using ImageProcessor.Configuration; | ||
|
||
/// <summary> | ||
/// The cair bootstrapper. | ||
/// </summary> | ||
internal static class CairBootstrapper | ||
{ | ||
/// <summary> | ||
/// Initializes static members of the <see cref="CairBootstrapper"/> class. | ||
/// </summary> | ||
static CairBootstrapper() | ||
{ | ||
RegisterCairExecutable(); | ||
} | ||
|
||
/// <summary> | ||
/// Gets the cair path. | ||
/// </summary> | ||
public static string CairPath { get; private set; } | ||
|
||
/// <summary> | ||
/// Gets the cair image path. | ||
/// </summary> | ||
public static string CairImagePath { get; private set; } | ||
|
||
/// <summary> | ||
/// Registers the embedded CAIR executable. | ||
/// </summary> | ||
public static void RegisterCairExecutable() | ||
{ | ||
// None of the tools used here are called using dllimport so we don't go through the normal registration channel. | ||
string folder = ImageProcessorBootstrapper.Instance.NativeBinaryFactory.Is64BitEnvironment ? "x64" : "x86"; | ||
Assembly assembly = Assembly.GetExecutingAssembly(); | ||
string targetBasePath = new Uri(assembly.Location).LocalPath; | ||
string multithreaderTargetPath = Path.GetFullPath(Path.Combine(targetBasePath, "..\\" + folder + "\\" + "pthreadVSE2.dll")); | ||
|
||
// Set the global variable. | ||
CairPath = Path.GetFullPath(Path.Combine(targetBasePath, "..\\" + folder + "\\" + "CAIR.exe")); | ||
CairImagePath = Path.GetFullPath(Path.Combine(targetBasePath, "..\\" + folder + "\\" + "cairimages\\")); | ||
|
||
// Get the resources and copy them across. | ||
const string CairResourcePath = "ImageProcessor.Plugins.Cair.Resources.Unmanaged.x86.CAIR.exe"; | ||
const string MultithreaderResourcePath = "ImageProcessor.Plugins.Cair.Resources.Unmanaged.x86.pthreadVSE2.dll"; | ||
|
||
// Write the two files out to the bin folder. | ||
// Copy out the threading binary. | ||
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(MultithreaderResourcePath)) | ||
{ | ||
if (resourceStream != null) | ||
{ | ||
// ReSharper disable once AssignNullToNotNullAttribute | ||
DirectoryInfo threaderDirectoryInfo = new DirectoryInfo(Path.GetDirectoryName(multithreaderTargetPath)); | ||
if (!threaderDirectoryInfo.Exists) | ||
{ | ||
threaderDirectoryInfo.Create(); | ||
} | ||
|
||
using (FileStream fileStream = File.OpenWrite(multithreaderTargetPath)) | ||
{ | ||
resourceStream.CopyTo(fileStream); | ||
} | ||
} | ||
} | ||
|
||
// Copy out the cair executable. | ||
using (Stream resourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(CairResourcePath)) | ||
{ | ||
if (resourceStream != null) | ||
{ | ||
// ReSharper disable once AssignNullToNotNullAttribute | ||
DirectoryInfo cairDirectoryInfo = new DirectoryInfo(Path.GetDirectoryName(CairPath)); | ||
if (!cairDirectoryInfo.Exists) | ||
{ | ||
cairDirectoryInfo.Create(); | ||
} | ||
|
||
using (FileStream fileStream = File.OpenWrite(CairPath)) | ||
{ | ||
resourceStream.CopyTo(fileStream); | ||
} | ||
} | ||
} | ||
|
||
// Lastly create the image folder for storing temporary images. | ||
// ReSharper disable once AssignNullToNotNullAttribute | ||
DirectoryInfo directoryInfo = new DirectoryInfo(Path.GetDirectoryName(CairImagePath)); | ||
if (!directoryInfo.Exists) | ||
{ | ||
directoryInfo.Create(); | ||
} | ||
} | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
src/Plugins/ImageProcessor/ImageProcessor.Plugins.Cair/ImageFactoryExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="ImageFactoryExtensions.cs" company="James South"> | ||
// Copyright (c) James South. | ||
// Licensed under the Apache License, Version 2.0. | ||
// </copyright> | ||
// <summary> | ||
// Extends the ImageFactory class to provide a fluent API. | ||
// </summary> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace ImageProcessor.Plugins.Cair | ||
{ | ||
using System.Collections.Generic; | ||
using System.Drawing; | ||
|
||
using ImageProcessor.Plugins.Cair.Imaging; | ||
using ImageProcessor.Plugins.Cair.Processors; | ||
|
||
/// <summary> | ||
/// Extends the ImageFactory class to provide a fluent API. | ||
/// </summary> | ||
public static class ImageFactoryExtensions | ||
{ | ||
/// <summary> | ||
/// Resizes the current image to the given dimensions using Content Aware Resizing. | ||
/// </summary> | ||
/// <param name="factory"> | ||
/// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class | ||
/// that this method extends. | ||
/// </param> | ||
/// <param name="size"> | ||
/// The <see cref="T:System.Drawing.Size"/> containing the width and height to set the image to. | ||
/// </param> | ||
/// <returns> | ||
/// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class. | ||
/// </returns> | ||
public static ImageFactory ContentAwareResize(this ImageFactory factory, Size size) | ||
{ | ||
if (factory.ShouldProcess) | ||
{ | ||
int width = size.Width; | ||
int height = size.Height; | ||
|
||
ContentAwareResizeLayer resizeLayer = new ContentAwareResizeLayer(new Size(width, height)); | ||
return factory.ContentAwareResize(resizeLayer); | ||
} | ||
|
||
return factory; | ||
} | ||
|
||
/// <summary> | ||
/// Resizes the current image to the given dimensions using Content Aware Resizing. | ||
/// </summary> | ||
/// <param name="factory"> | ||
/// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class | ||
/// that this method extends. | ||
/// </param> | ||
/// <param name="layer"> | ||
/// The <see cref="ContentAwareResizeLayer"/> containing the properties required to resize the image. | ||
/// </param> | ||
/// <returns> | ||
/// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class. | ||
/// </returns> | ||
public static ImageFactory ContentAwareResize(this ImageFactory factory, ContentAwareResizeLayer layer) | ||
{ | ||
if (factory.ShouldProcess) | ||
{ | ||
Dictionary<string, string> resizeSettings = new Dictionary<string, string> { { "MaxWidth", layer.Size.Width.ToString("G") }, { "MaxHeight", layer.Size.Height.ToString("G") } }; | ||
|
||
ContentAwareResize resize = new ContentAwareResize { DynamicParameter = layer, Settings = resizeSettings }; | ||
factory.CurrentImageFormat.ApplyProcessor(resize.ProcessImage, factory); | ||
} | ||
|
||
return factory; | ||
} | ||
} | ||
} |
Whoa there!
You have triggered an abuse detection mechanism.
Please wait a few minutes before you try again;
in some cases this may take up to an hour.