简体   繁体   中英

ASP.net server side image manipulation library needed to superimpose two images

We currently have a website in Asp.net c# and we are looking to add functionality where our users can upload a profile picture and we then superimpose this image within another image to create them a personalized business card for the site.

I have been searching for a package to do this for a while but unable to find one that suits us perfectly. Ive seen OpenCV and imagemagick but they dont look like they help. Im also looking for the package to have functionality to allow us to rotate and tilt the original image.

Any ideas or recommendations on how to do it?

Thanks in advance.

Incidentally, I wrote a similar library some time ago, and you can find it on CodeCanyon ( ImageHandler ).

Take a look to the demo page, I think the functionality you want should be the watermarking.

Keep in mind that the component came out with a core library, an httphandler, an mvc3 htmlhelper and a webforms custom control. And you can use the core library even in a non-web context.

System.Drawing is a good option, but beware that although it will work most of the time on a server-side application, it is not supported by Microsoft. We've had numerous issues where we get the following exception after prolonged use:

Win32Exception: The operation completed successfully
at MS.Win32.HwndWrapper..ctor(Int32 classStyle, Int32 style, Int32 exStyle, Int32 x, Int32 y, Int32 width, Int32 height, String name, IntPtr parent, HwndWrapperHook[] hooks)
at System.Windows.Media.MediaContextNotificationWindow..ctor(MediaContext ownerMediaContext)
at System.Windows.Media.MediaContext..ctor(Dispatcher dispatcher)

Under .NET 2.0/3.5 we also saw a similar exception in the Media.Brush constructor.

We found that this can be avoided by spawning a single 'STA' thread and invoking all such UI requests over to that thread. In our case, one thread seems to be plenty, so we haven't experimented with multiple STA threads. Using an STA threads seem to be required to avoid the above exceptions under load.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM