Resizing images to a fixed size - c#

I need to resize images with multiple dimensions to same size . Those are profile images and I can crop width or height of image if needed to make aspect ratio similar . Also I need to add watermark to image . Suggest any library which is good for image manipulation.
Thanks

Image Magick is very good, has bindings to most language and is available for most operating systems - it is also free.

Here is a short list I can remember:
http://www.graphicsmill.com/
http://imageresizing.net/
http://www.atalasoft.com/products/dotimage/
http://www.coreoptical.com/
http://www.leadtools.com/
Actually your task is pretty simple so I guess most of SDKs will easily handle that. And if you don’t need any specials about .net integration, Image Magick should be good enough.

Related

losing quality when resizing with ImageResizer

I'm using the ImageResizer .net library. It works as expected, but one image messes around.
I've uploaded the image below. I've already tried some things like format=jpg&quality=100, only width=220, also different sizes, but it always adds this blurry border around the image.
The original image is a png.
This one is the original image:
This one is resized by the ImageResizer:
And this one is resized with photoshop:
EDIT:
If you're running into the same issue. Try to set up the SpeedOrQuality Plugin. I've set it to speed=3 and the image is sharp again.
Vector graphics require different resampling algorithms than photographs.
ImageResizer V4 includes higher quality image resampling options under the FastScaling plugin.
For graphics (non-photographic images), I suggest playing with &f.sharpen=0..100, &down.preserve=-5..5, and &down.filter=Robidoux. Make sure &fastscale=true and FastScaling is installed.
You can certainly find a good configuration for your rasterized vector art and set up a preset for it. FastScaling is capable of much better resampling than Photoshop - on par with Lightroom, in fact.
Enabling fastscaling alone helps substantially (?width=200&fastscale=true):
Adding sharpening gives a very clear result: (?width=220&fastscale=true&f.sharpen=100):
Visibly crisper than Photoshop:
Each time you save a jpeg, you loose quality (the image is reencoded).
I would recommend using the same quality as the original image was save against, it should give the best results.
Using a higher quality is not recommended as it will artificially try to improve quality, mistaking approximations done by previous encoding for details, resulting in things like the blurry border.
Aside that, usually, one should not use a quality over 95 for jpeg encoding.

Resize image with scale and crop in C#

When I upload an image, it is quite big some times, I have to create its thumbnail in a specific way.
What I want is if I declare the size of 96x69 for the thumbnail, those uploaded images which are scalable to this resolution should be scaled, and those uploaded images which are quite different in wxh, example 1000x1000, they should be cropped to maximum better scalability.
Is there any fast library or built in code as I have tried to do in my own way but it is not that perfect?
I strongly recommend ImageResizer which can be found freely on the Nuget. Basically, resizing images is a sophisticated procedure that may be included variety techniques such as cropping, scaling, resizing, moving, trimming, etc. that implementing each of these methods is not an easy job. Hence, it's better to use image-resizer.
you can use jquery for solving this problem. If its feasible in your project to do it client side.
Check these link here..
http://www.jqueryrain.com/demo/jquery-crop-image-plugin/
and
https://code.google.com/p/resize-crop/ this one is best and easiest i guess.
If you want to do it server side for some reason, then have a look on solution mentioned in this question.
Which free image resizing library can I use for resizing and probably serving images?
Hope this will solve your problem.

Content-Aware Image Cropping with C#

I am working on a CMS like project which users can upload images with contents. I have to create thumbnails for the uploaded images on the fly. Lets say the thumbnail size as 125x75
I can resize images without problem but when it comes to crop operation several problems occur. My resize and crop procedure works like this:
Load the original image.
Resize the image to desired size preventing the original aspect ratio depending on the given maximum width or height
If the result image has a different aspect ration than the output aspect ratio than a centered crop operation is applied.
But what I want to achive is a content-aware cropping as described in Jue Wang's article Opticrop: Content-aware Cropping with PHP and ImageMagick
Is there any way to do it with C# or is there a library that can do this operation.
Note: I do not want content-aware resizing. Content-aware resizing (seam craving) can be done with ImageResizing.net SeamCarving plugin
If you are using the ImageResizing.net framework, the WhitespaceTrimmer plugin may be a good starting point I think.
If you want to write the code yourself, this Gist shows a good solution using entropy but is written in Ruby.

How do you change the color of an Image in WPF?

I have a .png image that's just white-on-transparent, and I'm wondering if there's an easy way to make that green-on-transparent, red-on-transparent, etc so I don't need to make separate .png files for each color.
Take a look at these CodeProject Articles
Image Processing Lab
ImageMagic-WPF Image Color Spaces
Image Processing Lab is a simple tool for image processing, which
includes different filters and tools to analyze images available in
the AForge.NET framework.
You could also take a look at the FormatConvertedBitmap, ColorConvertedBitmap or WritableBitmap Class's
For a simpler solution that doesn't require pulling in huge libraries and lets you understand what's going on under their hood (and thus gives you greater flexibility), learn how to use WPF Pixel Shaders (google it).
Then you can use something like the multiply shader here: http://rakeshravuri.blogspot.com/2008/08/blending-modes-in-wpf-using.html

Zooming an extremely large image

Is there any predefined control in WPF or VS2010 to implement the Image Zooming functionality (like Googlemaps) for a bitmap displayed over a panel using C#? My bitmap will be minimum 8GB in Size.
Thanks in advance
Murali
There is DeepZoom for Silvelight. There is no such thing in WPF. It was planned for WPF4, but removed before RTM.
Update:
Loading images of this size is pretty uncommon. You should consider tiling as others suggested. Also consider if you really need load all data at once. If the image has size of for example 30000x30000 then the user do not really need/can't to see all this data. Use tiling and appropriate image format (jpg etc) for each zoom level.
Relevant links:
Single objects still limited to 2 GB in size in CLR 4.0?
Pushing the Limits of Windows: Physical Memory

Categories

Resources