标签: imageprocessor

将resize算法拆分为两遍

我编写了以下调整大小算法,可以正确地向上或向下缩放图像.虽然由于每个循环上的权重数组的内部迭代,但它太慢了.

我相当肯定我应该能够将算法分成两个通道,就像你使用两次通过高斯模糊一样,这将极大地降低操作复杂性并加快性能.不幸的是我无法让它发挥作用.有人能帮忙吗?

Parallel.For(
    startY,
    endY,
    y =>
    {
        if (y >= targetY && y < targetBottom)
        {
            Weight[] verticalValues = this.verticalWeights[y].Values;

            for (int x = startX; x < endX; x++)
            {
                Weight[] horizontalValues = this.horizontalWeights[x].Values;

                // Destination color components
                Color destination = new Color();

                // This is where there is too much operation complexity.
                foreach (Weight yw in verticalValues)
                {
                    int originY = yw.Index;

                    foreach (Weight xw in horizontalValues)
                    {
                        int originX = xw.Index;
                        Color sourceColor = Color.Expand(source[originX, originY]);
                        float …
Run Code Online (Sandbox Code Playgroud)

c# algorithm image-processing imageprocessor

26
推荐指数
1
解决办法
680
查看次数

基于密钥的异步锁定

我试图弄清楚,已经提出了与我的ImageProcessor库的问题在这里添加项目到缓存中,当在那里我得到间歇性文件访问错误.

System.IO.IOException:进程无法访问文件'D:\ home\site\wwwroot\app_data\cache\0\6\5\f\2\7\065f27fc2c8e843443d210a1e84d1ea28bbab6c4.webp',因为它正被另一个进程使用.

我编写了一个类,用于基于散列网址生成的密钥执行异步锁定,但似乎我在实现中遗漏了一些东西.

我的锁类

public sealed class AsyncDuplicateLock
{
    /// <summary>
    /// The collection of semaphore slims.
    /// </summary>
    private static readonly ConcurrentDictionary<object, SemaphoreSlim> SemaphoreSlims
                            = new ConcurrentDictionary<object, SemaphoreSlim>();

    /// <summary>
    /// Locks against the given key.
    /// </summary>
    /// <param name="key">
    /// The key that identifies the current object.
    /// </param>
    /// <returns>
    /// The disposable <see cref="Task"/>.
    /// </returns>
    public IDisposable Lock(object key)
    {
        DisposableScope releaser = new DisposableScope(
        key,
        s =>
        {
            SemaphoreSlim locker; …
Run Code Online (Sandbox Code Playgroud)

c# multithreading locking async-await imageprocessor

17
推荐指数
2
解决办法
4809
查看次数

如何在AspNet.Core中读取EXIF数据

在Asp.Net Core中读取图片的EXIF信息的最佳方法是什么.我正在使用myget中的ImageProcessorCore alpha来旋转图片,但我还没有找到一种方法来读取exif数据是否有库存方式这样做?

c# imageprocessor asp.net-core asp.net-core-1.0

10
推荐指数
2
解决办法
3283
查看次数

模仿这种成像效果

我问这个问题是因为另一个问题已经两年了并且没有准确回答。

我希望用 C#复制本文中提到的 PhotoShop 效果。Adobe 称它为彩色半色调,我认为它看起来像是某种旋转的 CMYK 半色调。无论哪种方式,我都不知道我会怎么做。

当前代码示例如下。

有任何想法吗?

彩色半色调效果

聚苯乙烯

这不是家庭作业。我希望升级我的 OSS 项目ImageProcessor 中的漫画书效果。

ImageProcessor 漫画效果

进度更新。

所以这里有一些代码来显示我到目前为止所做的......

我可以相当容易和准确地在 CMYK 和 RGB 之间进行转换,足以满足我的需要,并且还可以根据一系列点的每个颜色分量的强度打印出一系列有图案的椭圆。

我刚才遇到的是旋转每种颜色的图形对象,以便将点放置在代码中指定的角度。任何人都可以给我一些关于如何去做的指示吗?

public Image ProcessImage(ImageFactory factory)
{
    Bitmap newImage = null;
    Image image = factory.Image;

    try
    {
        int width = image.Width;
        int height = image.Height;

        // These need to be used.
        float cyanAngle = 105f;
        float magentaAngle = 75f;
        float yellowAngle = 90f;
        float keylineAngle = 15f;

        newImage = new Bitmap(width, height);
        newImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);

        using …
Run Code Online (Sandbox Code Playgroud)

c# graphics imageprocessor

5
推荐指数
1
解决办法
768
查看次数

ImageProcessor/Windows Azure存储问题,返回403 Forbidden

这些图像可以加载到本地ENV中,也可以加载到生产环境中.但是,没有任何理由,登台环境无法加载这些.

<package id="ImageProcessor" version="2.2.0.0" targetFramework="net45" />
  <package id="ImageProcessor.Web" version="4.2.1.0" targetFramework="net45" />
  <package id="ImageProcessor.Web.Config" version="2.2.0.0" targetFramework="net45" />
  <package id="ImageProcessor.Web.Plugins.AzureBlobCache" version="1.0.0.0" targetFramework="net45" />
  <package id="ImageProcessor.Web.PostProcessor" version="1.0.2.0" targetFramework="net45" />
  <package id="UmbracoAzureBlobStorageProvider" version="1.0.10.5" targetFramework="net45" />
  <package id="WindowsAzure.Storage" version="4.3.0" targetFramework="net45" />
Run Code Online (Sandbox Code Playgroud)

我正在使用ImageProcessor,并根据需要将域列入白名单:

<whitelist>
        <add url="http://conceptjp.blob.core.windows.net/"/>
        <add url="https://az739977.vo.msecnd.net/"/>
</whitelist>
Run Code Online (Sandbox Code Playgroud)

https://staging.conceptjp.com/remote.axd?https://az739977.vo.msecnd.net/media/6883/logo-sparitual.png?quality=70(不起作用)

https://conceptjp.com/remote.axd?https://az739977.vo.msecnd.net/media/6883/logo-sparitual.png?quality=70(works)

https://cjp.local/remote.axd?https://az739977.vo.msecnd.net/media/6883/logo-sparitual.png?quality = 70(作品,当地环境)

2016-10-04 13:31:11.2393 Logging.TheLogger The remote server returned an error: (403) Forbidden. The remote server returned an error: (403) Forbidden.    at Microsoft.WindowsAzure.Storage.Core.Executor.Executor.EndExecuteAsync[T](IAsyncResult result)
   at Microsoft.WindowsAzure.Storage.Core.Util.AsyncExtensions.<>c__DisplayClass1`1.<CreateCallback>b__0(IAsyncResult ar)
--- End of stack …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc umbraco azure-storage imageprocessor

2
推荐指数
1
解决办法
727
查看次数

ImageProcessor 调整大小后似乎将图像旋转 90 度

我使用 nuget for c# 下载了 ImageProcessor 库。我正在使用它来上传网站的图像并调整其大小。上传过程工作正常,除了当我尝试查看上传的图像时,它看起来从原始图像向后旋转了 90 度。这是我正在使用的代码:

        ISupportedImageFormat format = new JpegFormat { Quality = 70 };

        using (MemoryStream inStream = new MemoryStream(_img))
        {
            using (MemoryStream outStream = new MemoryStream())
            {
                // Initialize the ImageFactory using the overload to preserve EXIF metadata.
                using (ImageFactory imageFactory = new ImageFactory(preserveExifData: false))
                {
                    // Load, resize, set the format and quality and save an image.
                    imageFactory.Load(inStream)
                        .Resize(new ResizeLayer(new Size(width, height), resizeMode: resizeMode))
                                .Format(format)
                                .Save(outStream);
                }

                return outStream.ToArray();
            }
        }
Run Code Online (Sandbox Code Playgroud)

c# image-processing image-uploading asp.net-mvc-4 imageprocessor

2
推荐指数
1
解决办法
3076
查看次数