c# - ImageResizing.Net behind WCF -


i've been evaluating nathanael jones amazing imaging library , plugins image processing services company building on azure. before acquiring license testing them ensure fit in within our scenario. favor , check them out here.

i'm having great success plugins when using them in asp.net mvc web application. i'm using image server functionality within controller post ui. cropping, resizing , simple/advanced filters working expected.

the problems having when move functionality wcf service class library within application. cropping , resizing work expected, filtering instructions (brightness, contrast, sepia, etc...) either being ignored or fail silently. here image processing code:

var instructions = new imageresizer.instructions();  //all of these instructions work instructions.width = 300; instructions.height = 300; instructions.mode = imageresizer.fitmode.crop; instructions.outputformat = imageresizer.outputformat.jpeg; instructions.jpegquality = 90;   double[] cropcoordinates = {0,100,0,100}; instructions.croprectangle = cropcoordinates;        instructions.mode = imageresizer.fitmode.crop;  //these instructions ignored, or fail silently instructions.invert = true; instructions.saturation = -1; instructions.sepia = true;  var imagejob = new imageresizer.imagejob();  imagejob.instructions  = instructions; imagejob.source = bmpsource; imagejob.dest = typeof(bitmap);  imagejob.build();  

i've duplicated web.config settings mvc application used app.config of class library using imageresizing packages (from nuget).

<configuration>     <configsections>         <section name="resizer" type="imageresizer.resizersection" requirepermission="false" />     </configsections>      <resizer>         <plugins>             <add name="simplefilters" />             <add name="advancedfilters" />         </plugins>     </resizer>  </configuration> 

and sure, i've included using statements main library plugins:

using imageresizer; using imageresizer.plugins.advancedfilters; using imageresizer.plugins.simplefilters; 

as mentioned, cropping , resizing work when moved class library wcf service, filters failing silently. images cropped , sized instructed, filters not applied images. i've tried several variations on installing libraries (even including packages on every project within solution).

could fact wcf service hosted net.tcp endpoint? should consider updating architecture have imaging services powered via web api wcf service posts to?

updated

i'm bypassing web.config/app.config installing plugins in code so:

imageresizer.configuration.config.current.plugins.install(new imageresizer.plugins.simplefilters.simplefilters()); imageresizer.configuration.config.current.plugins.install(new imageresizer.plugins.advancedfilters.advancedfilters()); 

i've verified plugins loaded within:

imageresizer.configuration.config.current.plugins 

am getting following error when imagejob.build(); called:

could not load file or assembly 'aforge.imaging, version=2.2.5.0, culture=neutral, publickeytoken=ba8ddea9676ca48b' or 1 of dependencies. system cannot find file specified.

hoping issue configuration i've added following using statements top of class uses imageresizer:

using aforge; using aforge.imaging; using aforge.imaging.filters; using aforge.imaging.colorreduction; using aforge.imaging.complexfilters; using aforge.imaging.textures; 

the configuration issues resolved still getting same error aforge libraries. have opened new question specific issue here

i suspect configuration not being loaded. can access diagnostics page debugging , inspecting imageresizer.configuration.config.current instance?

you might consider configuring software code - creating new config instance , installing plugins on it, using each image job.

overall, suggest using httpmodule, way intended - particularly if want levergage disk caching.


Popular posts from this blog