.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

creating an image resizer by C#.net

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :ASP.Net
Hello everybody, can anyone help me to create an image resizer by c#.net Like, I have an image (100 X 100 pixels) . Now I want to resize this image by 50 X 50 pixels or 50 X 70 pixels according to my requirement. How can I create this resizer. Please help me.

View Complete Post

More Related Resource Links

image resizer not working


I thought the following image resizer with the following code was working with smaller images but one thing I know for sure is that it's not working with larger ones. I want to have a max height of 300 px. The dimensions work out fine but don't save with the file. If someone can help me understand a better way, I'd appreciate it.

    Protected Sub FormatImage(ByVal ful As FileUpload, ByVal strFile As String) 
        Const intMaxWidth As Integer = 300 'max width
        Const intMaxHgt As Integer = 300 'max height
        Dim intNewWidth, intNewHgt As Integer 'new width/height
        Dim sglSize As Single 'temp variable used when calculating new size
        Dim imgOriginal As Image 'holds the original image
        Dim dblWidthProp, dblHgtProp As Double
        imgOriginal = Image.FromStream(ful.FileContent)
        intNewWidth = imgOriginal.Width
        intNewHgt = imgOriginal.Height
        Dim imgOutput As New Bitmap(intNewWidth, intNewHgt)
        If strFile IsNot Nothing And CheckFileFormat(strFile) = True Then
                Do While intNewWidth > 300 Or intNewHgt > 300
                    dblWidthProp = imgOriginal.Width / intMaxWidth
                    dblHgtProp = imgOriginal.Height / intMaxHgt
                    If dblWidthProp > dblHgtProp Then

Silverlight - Creating Image Map with Hotspots


Recently I was working on a Silverlight application and one of the pages contains a graphic. One of the requirements is that the graphic should contain clickable regions (Hotspots) and display a dynamic navigation menu when the end users click on it. An image that contains one or more Hotspots or clickable area is called an image map. I have put together a simple tutorial on how to get this done.

Getting Started
Image map can be created by using Microsoft Expression Design or Expression Blend.

If you do not have Microsoft Expression Design, you can download a trial version from here.
If you do not have Microsoft Expression Blend, you can download a trial version from here.

Creating image based site navigation using standard sitemap

I know how to create a normal menu and change them the way i want using css, but I dont know how to use images instead of text.I want to make it look cooler using images so in order to do that, I haven't got any ideas at all :(I have seen many websites on internet like this and I dont think its a difficult thing to do for some of you here.Could you please guide me or show me the way forward ? Thanks. 

Creating Barcode Image

Hello Guys.Posted a question earlier but i havent recieved a reply. i wanted to create a barcode using vbscript or javascripting. Dont know if this makes a difference which one i use  The barcode will be linked to information stored in my access database. The barcode will be displayed on a webpage, so for this i'm using Dreamweaver CS4. I have to 2 barcode fonts available and DLL file they are:FRE3OF9X.TTFi2of5txt.ttfBarcode.dll (not sure i need this)I prefer to use the interleaved 2of5 font. I have no experience of coding in general Vbscript or asp.net. From this situation how would i go about creating a barcode image.All feedback welcome. Thank you very much...

Creating gridlines/cells over an image?




I pretty much want to display an image and then somehow overlap that image with gridlines...but the thing is, I need to be able to select one or more of those cells in each of the grids when I mouse drag so then when I click a cell in the gridline, I can find out which cell I am at that I've set up. What's the easiest way to do this?

Creating a Blank New Image Album


Hi, I am trying to figure out how to get fresh photo album. I am able to upload pictures to the database and display them(using handler & listview), but when I go to create a new album it shows the previously uploaded pictures of the first one. In the database it shows a new ImageAlbumID so it is creating a new album, but just shows the old pictures of previously created albums. I want just a blank page with the AjaxUploader. Any help would be appreciated, thanks Jake

Here is the code:

<%@ Page Title="" Language="VB" MasterPageFile="~/masterpages/postmaster.master" AutoEventWireup="false" CodeFile

creating image



I have created a table in sql with columns username,password and image with datatype string,string,image.so,now iam not able to insert image into image column.how can i perform this operation.


Creating TreeView with loading image


I have created one treeView which is loading node dynamically (populateondemand ). its working perfectly fine. But I want to show loading when its populating node from client view. 

Note : - Only on click of image of the Tree view should display loading ..

Please give some code example.

Getting a black image when creating thumbnail


I'm trying to save two images to the DB, the original image and a thumbnail of the original.

But all I'm getting is a black image :/
I'm also trying to keep the proportions of the original image when creating the thumbnail, and I hope I'm right.

System.Drawing.Image img = System.Drawing.Image.FromStream(FileUpload1.PostedFile.InputStream);
decimal w = img.Width, h = img.Height;
int newHeight = 0;

// Keep proportions of thumbnail if width is above 120px
if (img.Width > 120) newHeight = (int)((w / h) * 120); else newHeight = img.Height;

System.Drawing.Image thumb = new System.Drawing.Bitmap(120, newHeight);
MemoryStream ms = new MemoryStream();
thumb.Save(ms, img.RawFormat);
Byte[] bytesThumb = ms.ToArray();

FileUpload1.PostedFile.InputStream.Seek(0, SeekOrigin.Begin);
Stream fs = FileUpload1.PostedFile.InputStream;
BinaryReader br = new BinaryReader(fs);
Byte[] bytes = br.ReadBytes((Int32)fs.Length);
sqlParam = cmd.Parameters.Add("@thumb", SqlDbType.VarBinary, -1);
sqlParam.Value = bytesThumb;

sqlParam = cmd.Parameters.Add("@data", SqlDbType.VarBinary, -1);
sqlParam.Value = bytes;

Thanks in advance!


creating a data structure from an image



i want to convert an image to a data structure(graph) can any one has an idea how to do this


Creating SP for storing the image.


I have created the SP(InsertImageLibrary) for storing image dynamically via  sql 2008 table called tbl_mImageLibrary.

But here am troubled by getting error like "Excepted string or text in the line13". code given below.

So can any one please help on this regard,..

CREATE procedure [dbo].[InsertImageLibrary]
@intImageLibId int ,
@varbinImage varchar(MAX)
declare @text_file as varchar(MAX)
declare @sql as varchar(MAX)
declare @val as varbinary(MAX)

SET @sql = 'select @text_file=(SELECT * FROM OPENROWSET ( BULK ''' + @varbinImage + ''',SINGLE_BLOB) AS BLOB)'
EXEC (@sql)
set @val= convert(varbinary,@text_file)

INSERT INTO tbl_mImageLibrary
set @intImageLibId=SCOPE_IDENTITY();
select @intImageLibId


Creating your SharePoint Governance Plan

One of the most common questions that I get from prospects as I'm talking to them about the creation of a governance plan and process is what does it look like. In other words, there are materials available which describe what should be in a governance plan but there isn't a ton of guidance on what the process of creating a governance plan and process are.

Creating Paging for a Repeater Control

A common question is "How do I implement paging within a Repeater?" Although the beauty of the Repeater control is its flexibility, you're on your own for building most functions. ASP.NET 2.0 has included some new controls that provide paging, as does the DataGrid in ASP.NET 1.1. However, this tip shows you how to roll your own paging for a simple data viewer.

Creating an AJAX Repeater in ASP.NET MVC

The "TaskList" is a tried an true example of the most basic thing that you can do in any framework. Unfortunately, I had some problems finding a really good example of all the steps necessary to get a task list to work in ASP.NET MVC 1.0.

Creating a Generic Entity Framework 4.0 Repository

With .NET 4.0 right around the corner, I thought it would be cool to download Visual Studio 2010 beta 2 and start playing around with the next release of Entity Framework.

The initial release of Entity Framework came with a great deal of criticism. To make matters worse, there was a large uproar when it was rumored that Microsoft would be abandoning LINQ to SQL, in favor of Entity Framework. This was because, at the time, many developers felt Entity Framework was an inferior technology to LINQ to SQL. To set things right, Microsoft proactively moved forward with improving Entity Framework, in time for the 4.0 release of the .NET Framework. This is good news because my initial impressions, so far, have been nothing but positive.

Creating a Simple Class in C#

The second article in the C# Object-Oriented Programming tutorial describes how classes are created in C# and how behaviour, in the form of publicly visible and private, hidden methods can be added. This demonstrates some of the uses of encapsulation

Creating SharePoint items with CreateItemActivity

Instead of creating new list items from code in your workflow you can use CreateItemActivity. CreateItemActivity can be used for creating list items or files. Properties of interest for this activity are the following (most of them are self-explanatory):
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend