Posted on April 12, 2008 by abhimjoshi
How to create Image reflection in Asp.Net=======================================
Method :———
public Image DrawReflection(Image _Image, Color _BackgroundColor, int _Reflectivity) { // Calculate the size of the new image int height = (int)(_Image.Height + [...]
Filed under: Asp.Net, C#, Resize Image | Leave a Comment »
Posted on January 29, 2008 by abhimjoshi
Download Image in Asp.Net=======================
string ImageFile = Server.MapPath(“Hello.jpg”);System.Drawing.Image objImage = System.Drawing.Bitmap.FromFile(ImageFile);Response.Clear();Response.ClearContent();Response.ContentType = “images/jpeg”;Response.AddHeader(“Content-Disposition”, “attachment; filename=Image.jpg;”);
MemoryStream objMem = new MemoryStream();objImage.Save(objMem, ImageFormat.Jpeg);objMem.WriteTo(Response.OutputStream);//objImage.Save(Response.OutputStream, ImageFormat.Jpeg);Response.End();
That’s It !!Hope you will like it.
Abhishek Joshi
Filed under: Resize Image | Leave a Comment »
Posted on March 6, 2007 by abhimjoshi
Use Namespace
================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
Code Behind
============
System.Drawing.Image img;
img = System.Drawing.Image.FromFile(cStrTextFileName);
Bitmap bmp = new System.Drawing.Bitmap(img);
System.Drawing.Image.GetThumbnailImageAbort imgCallBack = new System.Drawing.Image.GetThumbnailImageAbort(CallBackMethod);
//System.Drawing.Bitmap bmpThumbnail = ((Bitmap)bmp.GetThumbnailImage(62, 48, imgCallBack, IntPtr.Zero));
/******************/
int[] HWRation = ResizeImageWithRatio(img, 120, 60);
/******************/
System.Drawing.Bitmap bmpThumbnail = ((Bitmap)bmp.GetThumbnailImage(HWRation[0], HWRation[1], imgCallBack, IntPtr.Zero));
//System.Drawing.Bitmap bmpThumbnail = ((Bitmap)bmp.GetThumbnailImage(120, 60, imgCallBack, IntPtr.Zero));
bmpThumbnail.SetResolution(img.HorizontalResolution, img.VerticalResolution);
img.Dispose();
bmpThumbnail.Save(Server.MapPath(“images/logo/”) + Session["userid"].ToString() + strExtension);
imgImage.src=”images/logo/” [...]
Filed under: Ration, Resize Image | Leave a Comment »