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


Top 5 Contributors of the Month
Kaviya Balasubramanian
Sgraph Infotech
Imran Ghani
Post New Web Links

resize whole bitmap

Posted By:      Posted Date: September 20, 2010    Points: 0   Category :Windows Application
 
hi, when i resize the bitmap,it shows part of the image in richtextbox

how can i resize/zoom the whole image,so that after resize i can see whole image,not part of image

can i use Graphic.DrawImage to resize whole image




View Complete Post


More Related Resource Links

resize png at time of uploding without loosing tranparancy of img

  

 

i have tryed so many code to resize n compress png img but after resize it loose it's tranparancy ,

any one have good code to fix this problem.



Bitmap FromFile space "file not found"

  

I am using aspose.slides to create PPTx's. Some of the process involves loading jpg's from another server and including them in the presentation. This works fine in my development environment. When I upload the site to its server, the jpg loading fails.

I am trying to access jpg's on the other server by:

   oFS = New FileStream(sFile, FileMode.Open, FileAccess.Read)

This causes an access violation error when run from the server.

I also boiled the code down to reading the file directly:

   oImg = System.Drawing.Bitmap.FromFile(sFilePath)

This causes a file not found error.

We have narrowed the problem down to the fact that the File Path has a space in it. How does one solve this problem (while still keeping the space, there is a lot of legacy data)? I have tried replacing the space with %20 or +. I have tried using Server.UrlEncode. The error message always comes back with the encoding in place (like no decoding

Bad quality after resize jpeg

  

Hi,

I wrote code that resize my photo to thumbnail (100x100px). The thumbnail is ok (is blur) on serwer (Windows Serwer 2008 x64) and the thumbnail is very bad (no blur and pixels are big) on serwer (Windows Serwer 2008 x86). Both serwers have framework .net 4.0.

I wrote code on VS 2010.

Below is my code:

public static void MakeThumbnail(string path, string prefix, string filename, Stream stream, string mime, int fixedWidth, int fixedHeight, bool allowCrop)
{
string newFullname = path + "\\" + prefix + filename;

//oryginalny obrazek
Image sourceOriginalImage = Image.FromStream(stream);

int width = sourceOriginalImage.Width;
int height = sourceOriginalImage.Height;

double widthD = Convert.ToDouble(width);
double heightD = Convert.ToDouble(height);
double fixedWidthD = Convert.ToDouble(fixedWidth);
double fixedHeightD = Convert.ToDouble(fixedHeight);

int newWidth = 0;
int newHeight = 0;

int cropX = 0;
int cropY = 0;

newWidth = fixedWidth;
newHeight = (int)(fixedWidthD / Xp);
cropY = Convert.ToInt32((newHeight -

Bitmap to Image Control - ImageUrl

  

 This is my first attempt at using the drawing features of asp.net.  I just want to start simple, and create a single color bar based on a value for a single graph.  I wrote this so far, but I can't figure out how to take the bitmap I just created, and apply it to the Image Control. Do I have to save the file first, and then reload it.

Plus, my box keeps coming out pure black, I trying to fill the box with a color. 

This is part of a web custom control, in which I dynamically created an Image Control. I want to apply the bitmap I made to the image control. 

  

Dim imgGoogle As Image
imgGoogle = New Image
imgGoogle.ImageAlign = ImageAlign.AbsMiddle
imgGoogle.ImageUrl = cs.GetWebResourceUrl(rsType, "ice5software.BotCatcher.Google.gif")
tdGoogle_Right.Controls.Add(imgGoogle)
 
  
Private Sub DrawBarGraph_Google(ByVal BarValue As Integer)

	Dim objBitmap As System.Drawing.Bitmap
	Dim objGraphics As S

Problem with Resize on x64/x86

  

Hi,

I wrote code that resize my photo to thumbnail (100x100px). The thumbnail is ok (is blur) on serwer (Windows Serwer 2008 x64) and the thumbnail is very bad (no blur and pixels are big) on serwer (Windows Serwer 2008 x86). Both serwers have framework .net 4.0.

I wrote code on VS 2010.

Below is my code:


public static void MakeThumbnail(string path, string prefix, string filename, Stream stream, string mime, int fixedWidth, int fixedHeight, bool allowCrop)
{
string newFullname = path + "\\" + prefix + filename;

//oryginalny obrazek
Image sourceOriginalImage = Image.FromStream(stream);

int width = sourceOriginalImage.Width;
int height = sourceOriginalImage.Height;

double widthD = Convert.ToDouble(width);
double heightD = Convert.ToDouble(height);
double fixedWidthD = Convert.ToDouble(fixedWidth);
double fixedHeightD = Convert.ToDouble(fixedHeight);

int newWidth = 0;
int newHeight = 0;

int cropX = 0;
int cropY = 0;

newWidth = fixedWidth;
newHeight = (int)(fixedWidthD / Xp);
cropY = Convert.T

Easy image processing(grayscale, sepia, negative, resize, brightness, contrast and opacity)

  
Howdie y'all,

I see a lot of questions in this forum about resizing images. Recently I created a code sample(with downloadable webapp), right here.

The class (downloaded or created) allows for very fast and easy processing of your images. And a lot of problems over here can be solved by simply using that class. I thought it might help to mention the code sample in this forum as well.

Cheers,

Wes

encoding/decoding a string to/from bitmap

  

I have two methods:

Encode - takes a string, converts it to array of bytes, uses bytes to specify colors, creates a color and sets a pixel based on bytes

Decode - takes a pixel, retrieves color (R,G,B) bytes and converts them to characters, that produces a string which was previously encoded

I'm using two for loops (img height/width) to specify position and access pixels

The issue is that once display (Control Panel\Appearance and Personalization\Display) changes to anything other then "Smaller - 100%",
bytes have different values during decoding, thus different string is produced (corrupted).

If the setting is set to "Smaller - 100%" the results are normal.

What can I do to avoid that problem?

Thanks in advance


Writing Bitmap to Response.OutputStream - Generic Error Occured in GDI+

  

Hi,

This is what I'm trying to do when I get the error on the server (it works on my local machine):

System.Drawing.Image image = System.Drawing.Image.FromFile(filepath);
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(image); 
image.Dispose();

Response.ContentType = "image/bmp";
bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Bmp);
bmp.Dispose();

I don't think it can be a permissions problem because this works on the server:

System.Drawing.Image image = System.Drawing.Image.FromFile(filepath);
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(image);
image.Dispose();

Response.ContentType = "image/jpeg";
bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
bmp.Dispose();

So how do I get this to work for a bitmap?

Thanks,
Dan


how to create a Bitmap with size(20000,30000) in c#

  
hi how to create a BitMap with size (20000,30000) using C#

How to resize iframe when content loads..

  
I have an iframe on website A which receives the controls from website B once the form is processed on website B. Here is the page on website A with the iframe. I have hard coded the height at 100px:<iframe id="hdnFrm" name="hdnFrm" src="" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="width:90%;height:100px"></iframe> <form action='http://www.link-exchangers.com/adv_links_addber.aspx' target='hdnFrm' method='post' name='form1'> <table width=90% align=center cellpadding=2 cellspacing=0 border=0> <tr><td valign=top>Contact email: </td><td><input type=text name=web_email value="<?=$web_email;?>" style='width:250px'></td></tr> <tr><td valign=top>Reciprocal link: </td><td><input id=web_recip type=text name=web_recip value="<?=$web_recip;?>" style='width:250px'></td></tr> <tr><td colspan=2 align=center><input type=submit value="Save" style='width:100px'></td></tr> </table></form> Once the Save button is clicked, website B processes the data in this form, and sends messages and a

How do i resize teh status bar items?

  
hi friends, i have the following status bar and i have added a color scheme so the it's clear what im asking of:     here what i want: 1. How do i set the statusstrip item colored in black to change it's length when teh form resizes and and i want all the other statusstrip items to have fixed size (that doesnt change) when form resizes? 2. How do i set the status strip item colored with pink and blue to fixed length but all others changes its lenght when form resizes? thanks

Displaying a System.Drawing.Bitmap in a WPF Image control

  
How would I convert a System.Drawing.Btimap into a comparable WPF image control so I can display in on my WPF window? Thanks

Converting to stream after resize for SQL Insert

  
Hey guys,I'm running with this. Public Function ImageData(ByVal fu As FileUpload) As Byte() If fu.HasFile Then Dim imageBytes As Byte() = New Byte(fu.PostedFile.InputStream.Length) {} fu.PostedFile.InputStream.Read(imageBytes, 0, imageBytes.Length) Return imageBytes Else Return Nothing End If End Function Public Function ImageResize(ByVal fu As FileUpload) As Bitmap Dim thumbWidth As Integer = 1024 Dim image As System.Drawing.Image = image.FromStream(fu.PostedFile.InputStream) 'Create a System.Drawing.Bitmap with the desired width and height of the thumbnail. Dim srcWidth As Integer = image.Width Dim srcHeight As Integer = image.Height Dim thumbHeight As Integer = (srcHeight / srcWidth) * thumbWidth Dim bmp As New Bitmap(thumbWidth, thumbHeight) 'Create a System.Drawing.Graphics object from the Bitmap which we will use to draw the high quality scaled image Dim gr As Graphics = Graphics.FromImage(bmp) 'Set the System.Drawing.Graphics object property SmoothingMode to HighQuality gr.SmoothingMode = Drawing2D.SmoothingMode.HighQuality 'Set the System.Drawing.Graphics object property CompositingQuality to HighQuality gr.CompositingQuality = Drawing2D.CompositingQuality.HighQu

Change Bitmap Resolution and Turn Black & White

  
i use this method to resize bitmaps. Bitmap OriginalBM = (Bitmap)Bitmap.FromStream(fileUploader.PostedFile.InputStream); Size newSize = new Size(300, 500); Bitmap Resizebm = new Bitmap(OriginalBM, newSize); Resizebm.Save(HttpContext.Current.Server.MapPath(yourPath) + yourImage, ImageFormat.Jpeg); OriginalBM.Dispose(); My question is how can i Change Bitmap Resolution and Turn Black & White?

Bitmap drawing

  
I am trying to draw objects (line, etc) on a Bitmap. However, I have run into some problems: the origin of the bitmap coordinate system is at the top-left corner of the bitmap. How can I have it set to the bottom-left corner? Also, I need to draw some real world objects on this bitmap: how can I transform or map the real world coordinates on the bitmap coordinate space? Any help is really appreciated as I am totally lost on this one.

Twain tiff to bitmap

  
I get tiff image handle frm twain. Now how should I convert it to Bitmap? static FromHbitmap doesnt workstatic internal FromGdiPlus also doesnt work .NET guy
Categories: 
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