Imageprocessor: Use ImageProcessor in .NETCore 1 Projects

Created on 6 Aug 2016  路  15Comments  路  Source: JimBobSquarePants/ImageProcessor

Hello,

Would you please guide me how to use your package in a .NETCore Project?

Thanks.

core question

All 15 comments

Hi there,

As specified in the Readme the Core package is alpha which means that it shouldn't be used in a production environment yet so please don't.

If you wish to evaluated the library though you can download the latest build package from the MyGet package repository.

Hope that helps

James

My question was something different. I just want to see how it works in a DotNetCore project. How can I import required files into a DotNetCore project!
Please guide me on this issue.

Using Myget as described is the only way to use the library in a DotNetCore project. If you need guidance on that I suggest you read the Microsoft documentation available online

the ImageFactory class is not available while I did get clone.... what should I do?!

Please help!

ImageFactory does not work in DotNetCore because System.Drawing is not part of DotNetCore. That is why there are two libraries - ImageProcessor and ImageProcessorCore.

This is all in the readme.

Dear Jim,
I eventually find out how to import your code into my project. The problem is that, I store image in Database and I need the Image to be converted to the Byte[] and I do that as follow:
MemoryStream st = new MemoryStream();
using (Stream file = image_data.OpenReadStream())
{
Image img = new Image(file);
img.Resize(400, 400);
img.Save(st);
}
byte[] b = new byte[st.Length];
st.Read(b, 0, (int)st.Length);
qe.image = b;
qe.image_name = image_data.FileName.ToString();
qe.image_type = image_data.ContentType.ToString();

The store procedure is working fine but the display procedure is not work. If I do not use your code and store the original version, it works fine.

Would you please help me on this matter?

Hi Amirzandi,

The issue tracker is not the place for questions, we have a Gitter channel for that. Have you read the contribution guidelines? This stuff is important.

That said, what is wrong with the MemoryStream.ToArray() method?

Also, don't store images in databases in that manner; it's a terrible idea, use the Filestream database type and store a pointer to an image stored in the filesystem or better yet use some sort of blob storage mechanism.

Ok thanks. I will share my problem via Gitter.im website and especially in your room.

Bests.

I think the problem is that it doesn't work with netcoreapp1.0, ImageProcessor seems to require net46 or similar framework.

Is this intentional? If the library targets only net45/net46 it can't be run in .NET Core only environments such as Linux.

It would be nice if it worked with this kind of project.json:


  "frameworks": {
    "netcoreapp1.0": {
      "dependencies": {
        "Microsoft.NETCore.App": {
          "type": "platform",
          "version": "1.0.0"
        }
      }
    }
  },

But in order to do this, the library must shake it's dependency on System.Drawing, which is being deprecated in .NET Core.

What dependency on System.Drawing?

Have you tested any of this?

I've just downloaded the latest nightly from the MyGet repository and installed it successfully into a .NET Core console application. Everything built perfectly.

Here's the resultant project.json

{
  "version": "1.0.0-*",
  "buildOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "ImageProcessorCore": "1.0.0-alpha1039",
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.0"
    }
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": "dnxcore50"
    }
  }
}

And here's a screenshot of the running console.

sample

@JimBobSquarePants sure I tested, not trolling, honest.

I think this might be the problem: If you start typing in Visual Studio to project.json "ImageProce..." it suggests this:

    "ImageProcessor": "2.4.4",

Naturally I chose that, I gather that is wrong? Also, I thought I was right because I read your benchmark project.json as an example: https://github.com/JimBobSquarePants/ImageProcessor/blob/Core/tests/ImageProcessorCore.Benchmarks/project.json which uses net461, and thought I did everthing right.

I see in your example that it should be "ImageProcessorCore": "1.0.0-alpha1039", will try with that.

Do you have the MyGet feed in your package manager settings? I always rely on Nuget Package Manager to install dependencies.

The benchmark project.json is set up like that because I am benchmarking against System.Drawing which requires the full .NET framework

ImageProcessor and ImageProcessorCore are two separate products. One that I now consider legacy which requires the full .NET Framework and relies on System.Drawing and the new one (Core) which has no dependencies outwith the basics.

Yes, got it working now with bleeding edge NuGet feed. Excellent library! Thanks.

Excellent. Have fun and please any feedback let me know.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

clarkd picture clarkd  路  8Comments

srdjo picture srdjo  路  6Comments

SergeBerwert picture SergeBerwert  路  4Comments

Parovka picture Parovka  路  4Comments

Jogai picture Jogai  路  6Comments