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

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

showing a bitmap in an image...

Posted By:      Posted Date: October 24, 2010    Points: 0   Category :WPF



Can someone please explain to me why the following code doesn't work (picture isn't shown):



  BitmapImage src = new BitmapImage();


  src.UriSource = new Uri("picture.jpg", UriKind.RelativeOrAbsolute);


  image1.Source = src;



...but works when the following lines are added:




  BitmapImage src = new BitmapImage();


  src.UriSource = new Uri("picture.jpg", UriKind.RelativeOrAbsolute);



  TransformedBitmap tb = new TransformedBitmap();


  tb.Source = src;


  image1.Source = src;



The Confused Beginner

View Complete Post

More Related Resource Links

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")
Private Sub DrawBarGraph_Google(ByVal BarValue As Integer)

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

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

image is showing in sql image viewer,but in aspx page it is not getting

dears , in sql 2005 table i created an image columnin that image colum i inserted an image in hex format. data like as follows.0xFFD8FFE00104A4649460110010100FFDB0430C88A88CAAACCCE101C121010101022181A141C28222A28262226262C303E342C2E3A2E2626364A363A40424646462A344C524C44503E444642FFDB0431CCC10E1020121220422C262C4242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242FFC401F001511111100000000123456789ABFFC40B5100213324355440017D12304115122131416135161722711432813FA182342B1C11552D1F0243362723F9A161718191AD25262728292A3435363738393A434445464748494A535455565758595A636465666768696A737475767778797A3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3FA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE1E2E3E4E5E6E7E8E9EAF1F2F3F4F5F6F7F8F9FAFFC401F103111111111000000123456789ABFFC40B5110212443475440127701231145213161241517617113223281814423FA1B1C19233352F0156272D1A162434E125F11718191A262728292A35363738393A434445464748494A535455565758595A636465666768696A7374D75767778797A3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3FA2A3A4A5A6A7A8A9AAB2B3B4B5B6B7B8B9BAC2C3C4C5C6C7C8C9CAD2D3D4D5D6D7D8D9DAE2E3E4E5E6E7E8E9EAF2F3F4F5F6F7F8F9FAFFC0011807803F3121021113111FFDD0402FFDA0C31021131103F0A6B1D43F3A42B0E03FED3F3F63FFD0685A5DB5216176D1B69058FFD15DB46DA80DB49B6811FFFD24D3F3F2A434AD46C9408FFFD38D52A511D21D3F8E97CBA763FFD43F651B2A4A176D1B698FFD53F6D1B6A61B28D94058FFD63F65

Can't edit metadata when showing the image.

I have an app that in the Left-hand pane Reads the filenames of the images in a folder and places them into a ListBox.  In the Right-hand pane there are a series of TextBoxes showing various pieces of metadata from the selected image file.  I can read and update the metadata with no trouble. As soon as I place an acutal image in the ListBox it stops updating.  Delving into the class for the metadata tells me that it 'Unable to get writtable property store for this property.'  I believe this is because with the image open in the ListBox it can't update the file. Is there a way to place an image in the ListBox without keeping the original image file open, maybe by using a clone, a thumbnail, or something. Following is is my image class.  You can see what I had to comment out to get it to work. Namespace Image.Viewer     Public Class MyImage         Private _image As ImageSource         Private _name As String         Public Sub New(ByVal image As ImageSource, _                                  ByVal name As String)           &

How convert bitmap to Image.source ?

I hold some bitmap object in the memory  ( simple System.Drawing.Bitmap ). I want to make some wpf image control to show this bitmap. I dont want to save the bitmap to the disk and then load it as URI to the wpf image control So, How can i do this simple action ?   Thanks.

Content Query WebPart (CQWP) not showing thumbnails of the rollup image



I have set up my CQWP to display pages from a newssite. This is working fine, but my rollup images is showing in full size. As I have understood, SharePoint has the ability to scale down pictures and showing them as thumnails.

In the "Fields to display:" I have set the path to "Thumbnail; Rollup Image; ".

Image background color is showing while i drag in content place holder in master page ???


Hi  ...

I had few icons and images in my old web project which had no issue with the images and icons background color.

Now i have changed the total look and layout of my web site. After doing so , my old images and icons as well as new images and icons backgroud color is also displaying in the image.

The same image is looking good in my old web site layout ...

I tried all the stuff to show only image not image background ... But , it is not happening ....

The main thing is the same images and icons background color is not showing in my old design ...

Look at the image background , it has grey color background. It was not happening in my old web site design

Plz help me to solve this .... 

About showing image with img src


Hello.. I need help here. I'm using Visual Studio 2008 to develop a web application. In the web, I have a page that can upload an image file to the folder of my server. And, in the other page, its showing whatever the picture that I uploaded before. The question is, why the picture can not be shown correctly? Do I have to upload the file to the folder that included in my VS Solution? Or is there any another way to display it properly? I have checked the code from the browser and the img src path is correct but the image just doesn's show up.. THanks

"Smushed" pixels / fuzzy image (even with bitmap class or nearestneighbor)


hi all--

we're having myriad problems with artifacts and other video issues, on three separate computers and three different video cards (2 ATI, 1 NVIDIA).

one of the main issues we're having is that there are certain times when pixels in an image turn fuzzy, even with RenderOptions.BitmapScalingMode="NearestNeighbor" and/or RenderOptions.EdgeMode="Aliased" and/or using the Bitmap class. i've also tried combinations of snapstodevicepixels and uselayoutrounding. 


  • the first picture (a screenshot, enlarged) shows what it (an image in a scatterviewitem, surface touch beta for win7) looks like with BitmapScalingMode set to HighQuality -- as expected, it's fuzzy

  • the second picture (also a screenshot) shows what it looks like when set to NearestNeighbor. looks great, right?

image not showing on browser


Hi Friends i m developing a website in asp.net. my web site is working fine but i m getting a problem with images. My web sites images are showing properly. Some time they come in first time, some time in second refresh. but when i refresh page some current showing images are start not showiing so each time my web page miss some images on ramdom base.

Please help me

thanks in advance .

Convert Bitmap to Image with transparency


I like to export the Bitmap directly to a Image without saving it.
How can i do that, if i save the image i get a correct png image.
But if i convert it on the way below, i get a black color on the transparancy part.
How can i solve this?

                                    Bitmap bm = new Bitmap(thumbnailImage);                                    
                                    //bm.Save(@"C:\temp\bw.png", System.Drawing.Imaging.ImageFormat.Png);

                                    thumbnailImage = (System.Drawing.Image)bm;

showing image


Hello everyone ,

I have the following code to show image in a report but it does not woke and more intrestingly it works in vs 2005 but now in vs 2010 it does not work

=Code.GetImageLocation(Fields!Amount.Value, Fields!Cost.Value)

 I have the code above in expression of image and I have the following code in the code section of report property

Public Shared Function GetImageLocation(ByVal Amount AS Double, ByVal Cost AS Double) AS String
       DIM tmpProfitLoss AS Double
       DIM tmpProfitPercentage AS Double
      'calculate profit/loss and determine percentage of profit ratio
       tmpProfitLoss = Amount - Cost
       tmpProfitPercentage = (tmpProfitLoss / Amount) * 100

       'check for loss first, then more then 10%
       If tmpProfitLoss < 0

Built-in Functions - Text and Image Functions in SQL Server

Text and image functions operate on TEXT, NTEXT and IMAGE data types. These data types are deprecated with SQL Server 2005 and should be replaced by VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) when possible. Alternatively you can also consider storing large string values using XML data type. Text and image functions are nondeterministic.

Future versions of SQL Server will not support TEXT, NTEXT and IMAGE data types. Columns with TEXT / NTEXT data type do not support commonly used string functions such as LEN, LEFT, RIGHT, etc. Furthermore, due to the large size of TEXT data you''re likely to see performance issues if you store such data in the database. However, at times you can''t help but use the TEXT / NTEXT / IMAGE data types (for example when supporting 3rd party databases when you cannot change the schema) - this is when text and image functions come in handy.

Program for Format Conversion of An Image

.NET provides extensive support for image conversion. Any image can be processed from one format to another. Most common formats to which .NET have support for are .BMP, .EMF, .GIF, .ICO, .JPG, .PNG, .TIF and .WMF.

Configuring Profile Image Export in SharePoint 2010

It's no secret that I am thrilled with the new social features of SharePoint 2010. I am most excited about the new Profile Picture handling. I strongly believe that the more we can show the faces of our colleagues to one another the more connected we will feel. Clearly Microsoft feels that way as witnessed by the many features that make use of the Profile Image like the Activity Feed and Colleagues list

Built-in Functions - Text and Image Functions

Text and image functions operate on TEXT, NTEXT and IMAGE data types. These data types are deprecated with SQL Server 2005 and should be replaced by VARCHAR(MAX), NVARCHAR(MAX) and VARBINARY(MAX) when possible. Alternatively you can also consider storing large string values using XML data type. Text and image functions are nondeterministic.

ASP.Net Upload Image to MS Access Database

As you learnt from the previous articles to upload image to the SQL Database in ASP.Net 2.0 and stream that image into the memory to retrieve it from the database and display it on the web page. In this article you will learn how to upload images to the MS Access database in ASP.Net 2.0

First of all create an Access Database and place it in the App_Data folder of ASP.Net web site project. Then create a table "tblImg" with the following fields:
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