Home All Groups Group Topic Archive Search About
Author
17 Jun 2009 3:03 PM
shapper
Hello,

Does anyone knows a C# library to manipulate images? Size, resolution,
etc ...

And if possible also check the size and type of an image.

I need to use something like this in my ASP.NET MVC project.

Thanks,

Miguel

Author
17 Jun 2009 5:41 PM
Peter Duniho
On Wed, 17 Jun 2009 08:03:46 -0700, shapper <mdmo***@gmail.com> wrote:

> Hello,
>
> Does anyone knows a C# library to manipulate images? Size, resolution,
> etc ...
>
> And if possible also check the size and type of an image.

Depends on what you mean.  There's limited support for images in the 
System.Drawing.Drawing2D namespace.  That may suffice for your needs (it's 
what I use for image manipulation).  For more advanced stuff, I recommend 
Google.  There are probably libraries out there, but I don't know what 
they are.

Pete
Are all your drivers up to date? click for free checkup

Author
17 Jun 2009 6:00 PM
Jeff Johnson
"shapper" <mdmo***@gmail.com> wrote in message
news:d9b16dd1-a27b-4592-90d6-90e8b76cb9c8@f19g2000yqo.googlegroups.com...

> Does anyone knows a C# library to manipulate images? Size, resolution,
> etc ...

Adding .drawing to the reply chain. Maybe Bob Powell will have a
suggestion....
Author
17 Jun 2009 6:22 PM
Gregory A. Beamer
shapper <mdmo***@gmail.com> wrote in news:d9b16dd1-a27b-4592-90d6-
90e8b76cb***@f19g2000yqo.googlegroups.com:

> Hello,
>
> Does anyone knows a C# library to manipulate images? Size, resolution,
> etc ...
>
> And if possible also check the size and type of an image.
>
> I need to use something like this in my ASP.NET MVC project.
>
> Thanks,
>
> Miguel


Basic manipulation can be done in the system.drawing namespace. For the
web it can be problematic, however, as there is only basic support for
gif and jpg (have not checked ping).

There are third party libs, like LeadTools, but they can be a bit pricey
if you are only doing basic image manipulation. I am fairly certain a
search could yield open or shared source libs if you don't need
something this heavy.

From experience, I tried to dynamically create gifs, and the MS
implementation is too limited to be of any real use (pixelation, only
256 color images, etc.). Same for JPG. Both are licensed, so it would
have been more expensive for Microsoft to go beyond the basics.


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
Show quoteHide quote
|      Think outside the box!             |
*******************************************
Author
18 Jun 2009 1:16 AM
Peter Duniho
On Wed, 17 Jun 2009 11:22:03 -0700, Gregory A. Beamer 
<NoSpamMgbworld@comcast.netnospamm> wrote:

> [...]
> From experience, I tried to dynamically create gifs, and the MS
> implementation is too limited to be of any real use (pixelation, only
> 256 color images, etc.). Same for JPG. Both are licensed, so it would
> have been more expensive for Microsoft to go beyond the basics.

I don't know what you mean here.  JPEG is not limited to 256 colors (and 
the GIF limitation is fundamental to the file format, not .NET).  
Resolution (which is what affects "pixelation") is as high as you want it, 
within reason (I believe that the .NET/GDI+ coordinate system is limited 
to 15 bits -- 32767 x 32767 -- and in any case, one would run into memory 
limitations at some point).

..NET includes interpolation modes that provide high-quality scaling of 
images as well, though of course if you are generating images from scratch 
this is not an issue.

The only way in which .NET is really limited is simply in feature set.  
For what it does support, quality is as good as it might be with something 
else.

And yes, you can save as PNG.  However, .NET doesn't provide any 
fine-grained control over the PNG compression used, and so file sizes may 
be somewhat larger than if compressed using a more full-featured tool.

Pete
Author
29 Jun 2009 3:14 PM
Gregory A. Beamer
"Peter Duniho" <NpOeStPe***@nnowslpianmk.com> wrote in
news:op.uvo4h8ja8jd0ej@clampitt:

> I don't know what you mean here.  JPEG is not limited to 256 colors
> (and  the GIF limitation is fundamental to the file format, not .NET).

GIF limitation is also set by the algorithm used. When .NET first came out
(or GDI+), I examined the GIF standards (Compuserve has the patent) and
there are different levels of implementation. With .NET, at least in 1.x
(may have changed?), you created a 256 color GIF even if you only had 4
colors. This made it bloated.

Perhaps all of this has now been updated and you can create better images,
but this is the reason I shied away from experimenting further with GDI+
for web work. If it has been improved in 2.x and greater, then I stand
corrected and perhaps should try GDI+ in web apps again?


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
Show quoteHide quote
|      Think outside the box!             |
*******************************************
Author
18 Jun 2009 5:06 AM
Arto Viitanen
shapper wrote:
> Hello,
>
> Does anyone knows a C# library to manipulate images? Size, resolution,
> etc ...
>
> And if possible also check the size and type of an image.
>
> I need to use something like this in my ASP.NET MVC project.
>
> Thanks,
>
> Miguel

How about ImageMagick's (http://www.imagemagick.org) .NET interface
MagickNet? I have used ImageMagick's cli interface and Java interface
but not the MagickNet, but if it works, it will give all you need and
more.

--
Arto Viitanen

Bookmark and Share