Image manipulation in asp.net/c# without System.Drawing/GDI+ - asp.net

Is there any alternative image manipulation library for .net? I would prefer something that is managed and open source.
I ask this because of two reasons:
I have encountered hard to debug GDI+ errors with System.Drawing in the past
I have read that using System.Drawing in asp.net web applications is not 100% supported.
Thanks!
edit: clarification, I know that System.Drawing can work asp.net web apps - I have used it in the past. I really just wonder if there are any managed image manipulation libraries for .net :)

You should look into the WPF Imaging libraries shipped with .NET 3.0. They're optimized and robust (used to run Aero, so you know they're efficient). They don't depend on the WPF dispatcher, are easily extensible, and officially supported. What more could you want?

I don't know of any fully-managed 2D drawing libraries that are either free or open-source (there appears to be a few commercially available, but OSS is the way to go). However, you might look into the Mono bindings to Cairo.
Cairo is a platform independent 2D drawing API. You can find more information about it at the Cairo homepage. The Cairo Wikipedia page also has some good info.
Cairo is also used fairly widely in the Open Source world, which to me says something about its robustness. Mozilla, Webkit, and Mono all use it, among others. Ironically, Mono actually uses it to back their System.Drawing implementation... go figure.
There might also be a way to use Mono's System.Drawing implementation as a drop-in replacement for the Microsoft implementation, though I'm not sure how or if that would even work. I would probably start by replacing the System.Drawing.dll reference with Mono's version, and then try to deal with any errors.

Anecdotal evidence #1: I have used GDI+ for on-the-fly image creation within ASP.NET with no problems. I'm not sure what the problems would even be.

With respect to (1), most of the hard to debug errors are due to not closing open handles (Dispose() in managed-land). I'm curious where you heard (2).

Related

Simple image operations for .NET Core 6 and beyond

I have some C# code that relies on doing really basic graphic operations such as getting and setting pixels, and drawing texts over images. This uses the System.Drawing package which Microsoft has dropped the ball on.
Microsoft says this: Migrate to one of the following libraries: ImageSharp, SkiaSharp, Microsoft.Maui.Graphics. The latter appears to be ill-documented and unstable.
Could anyone with experience with these packages suggest an easy and simple way forward?
I am even wondering if it might pay to write my own library for the Windows bitmap format (which is sufficient for my purposes).
Yours frustratingly...
It depends on which platform you are building your app, but SkiaSharp 2.80.2 or 2.80.3 can be a good choice. There are quite a bit problems in newer packages, so you need to be careful which version you install so that you do not run into performance problems or bugs.

Is there for QT an equivalent to Microsoft Blend or Adobe tools?

After working extensively with Microsoft development tools, I migrated to ubuntu and QT for research purposes.
QT is a great framework, up to now there's nothing I needed and it's not there.
However the tools-ecosystem around QT is a bit behind microsoft's ecosystem (V.Studio, Expression Suite)
More specifically, QT Creator is quite nice, but the lack of a 'standard' tool like MS-Blend (which I think is a must, complementary to V.Studio) or the various Adobe tools is pretty apparent, in the case of developing fancy interfaces, animations etc. And Animations (e.g. menu's apperaing/disapperaing from the side) are a bit painful to hardcode without a 'graphical'-tool.
Do you have any tool to propose for this reason, that I'm not aware of?
PS - Just to avoid misunderstandings, I know about qml/Qt_Quick/qdesigner/qt_Animation - http://doc.qt.digia.com/qt/animation-overview.html. I'm referring to accombining software that make's life easier and reduces time needed for hardcoding stuff
Direct answer:
No there is no tool available in Qt arena that matches the capabilities of Microsoft Blend.
There is this question, which discusses a similar situation; a comparison between .NET and Qt in terms of UI designing.

Why C++/CLI does not support web applications?

I spent some time to learn C++/CLI, I feel it is powerful .Net language specially in interoperability concept. I think it will be great step if this language will extend its interoperability to include asp.net, till now the recent version doesn't support asp. But I don't know if there is a plan to do that in future version. Is there any reason that made the last version of C++/CLI can not deal with asp like C# or VB?
C++/CLI was never meant as a general-purpose language. It pretty much exists just for interoperability purposes.
If you have a C/C++ library that you want to use in your .Net application (be it your own code or something like WinAPI), C++/CLI is a good way to either create a managed wrapper for that library or to completely write the whole application, if that's not that much work.
Other than that, you should probably use C# (I think it doesn't make much sense to learn VB.NET if you already know C++). Other alternatives are F# if you think your application would benefit from a functional style. Or IronPython (or IronRuby) if you think you would benefit from dynamic typing.
And of course, you can mix the languages if part of the application would be better in one of them and other part in different one.
Another reasons against using C++/CLI at all are its weak support in VS (no IntelliSense) and the ability of C# to interoperate with native DLLs using P/Invoke.
To reiterate, use C++/CLI if you need to interoperate with native DLLs or already written C/C++ code. For other tasks, you should probably use C#.
The Visual C++ compiler does not support partial class, that is, until C++/CX come along with the help of WinRT projection. The one-obj-file-per-cpp tradition is hard to break.
Without the partial class feature, form designers need to edit the same file you are working on. That means parsing a file with a lot of irrelevant text, dealing with macros, etc, and most importantly avoiding bugs that would replace your important code as designer-generated. I can't think of many teams want to deal with that, especially for small teams like the Settings editor.
Besides, C++ parsers are slower than those for simpler languages. For web designers, if switching to a similair language can get a faster designer and compiler, why not?
I'm not sure if there's any reason ASP.NET does not natively support C++ inline within aspx files besides the development team didn't think it was worth the cost (I'm assuming this is what you mean).
You should be able to implement code behinds in C++, however. This should get you 95% of the way there, although you'll still need to code your pages in C# or VB.NET.
http://www.codeproject.com/KB/mcpp/helloworldmc.aspx (not my article, just a reference)

Can you recommend a good image manipulation dll for ASP.NET

Looking for a library that will allow me to size and resize images using c# and ASP.net on a Windows 2003 Server.
DISCLAIMER: I'm the author.
The free ImageResizing.Net library is precisely what you're looking for.
It's stable, mature (since 2007), actively developed, supported, and... open source.
It is specifically designed to provide image manipulation for ASP.NET, while avoiding all of the GDI bugs. It provides a highly-scalable and efficient manipulation API that often only requires 1 line of code to use. It doesn't leak memory or handles, and has 0 known bugs as of this writing.
If you decide to roll your own solution, PLEASE read this list of pitfalls to avoid. And for those thinking WIC is the solution - it is unsupported for use from ASP.NET.
Site link:
ASP.NET Image Resizing Module for IIS
Another free (Microsoft blessed) alternative is System.Web.Helpers.WebImage. WebImage is part of the ASP.NET Web Pages library.
After installation, the assemblies are located in:
Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies
Example
public void GetResized()
{
new WebImage(ImagePath)
.Resize(200, 200) // resize image to 200x200 px
.Write();
}
Other example usages here.
Just use the built-in classes in the System.Drawing namespace: http://msdn.microsoft.com/en-us/library/system.drawing.image.aspx
Note, as was pointed out in the comment below, the Windows Imaging Components may be a better fit.
Here is a tutorial: http://www.switchonthecode.com/tutorials/csharp-tutorial-image-editing-saving-cropping-and-resizing
I'm currently using Atalasoft Photo (Free) DotImage SDK for basic image manipulation:
http://www.atalasoft.com/products/dotimage/feature-matrix
Works well for my needs and including thumbnail processing & cropping and has tons of image format support which also comes free with the SDK.

a simple .net website source control system?

I work in Visual Studio working on sites mostly myself and occasionally I start on new features for a site and bam a bug pops up on the live site and now I am in the middle of changes and can't post a fix to the bug until everything I started to change is complete.
So I am looking for a nice an simple way to work with this type of situation - any suggestions?
Are you asking for a recommendation of a source control system? SourceGear Vault is free for single users.
I am big fan of subversion. There also plugins for VS to work with subversion repository.
http://subversion.tigris.org/
http://ankhsvn.open.collab.net/
I am in a similar situation and I use Perforce. It is free for up to two users and integrates well with Visual Studio.
Subversion is well supported and has tools for most any environment. It's also mostly straightforward to use, so you should be able to get up and running quickly.
If you need to work on a lot of separate features and bugs at the same time, you might try Mercurial instead. The tooling support is a lot less mature but I find the distributed design to do a better job of merging and facilitating work on separate issues concurrently.
But really, if you aren't using anything currently and aren't sure what your needs are, just choose one that has support in the IDE/tools you use. It will probably be Subversion.

Resources