Can I display an image without getting the image from a URL?

From what I've read, it appears you can take an image and create a thumbnail of it with the result being a type 'image'.

However, a search of dozens of sites suggests (hopefully this isn't true) that one always uses the URL of an image file to get the image to a control--meaning I can't just use the image created from the workup of an original image.

I'm posting the demo code I'm trying, hoping that maybe I'm missing one or two easy steps. 


        Dim FullImage As Image = Image.FromFile("C:\temp\Picture1.jpg")
        Dim Thumbnail As Image
        Dim FileName As String
        Dim inp As New IntPtr()
        Dim width As Integer = 60
        Dim height As Integer = 45

        Thumbnail = FullImage.GetThumbnailImage(width, height, Nothing, inp)

        ? MyImage.Something = Thumbnail

        ? MyImage.Something = Thumbnail.Something


my control on the front page is

<asp:Image ID="MyImage" runat="server" />

 Thank you for your help,


Larry Dechent - Sampson Coatings has 29 examples (C# & VB) to help beginners with ASP.NET.
11/25/2008 8:21:25 PM 93655 articles. 6 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 57

I was trying to do the same thing a few months ago. I could not come across a solution where you could assign an "Image" data type to a <asp:Image control.

What I ended up doing (based on other suggestions) was
<asp:Image ID="MyImage" runat="server" ImageUrl="http://yoursite/GetImage.aspx?OriginalImagePath=images/Picture.jpg" />

Then in GetImage.aspx Page_Load
Dim FullImage As Image = Image.FromFile(/*get path from QueryString*/)
Thumbnail = FullImage.GetThumbnailImage(width, height, Nothing, inp)
/*Code to change page header information from html to .gif or .jpeg and binary write the Thumbnail to the page.*/

Again, there might be an easier solution but I couldn't find it at the time I was researching it.

Hope this helps!

Remember to select "Mark as Answer" on the post that helped you find the solution!
11/26/2008 1:19:01 AM

Thank you for the suggestion.  I'm going to look into it.  Is there some word for what you are doing with the


section, a word I could put into Google?


Larry Dechent - Sampson Coatings has 29 examples (C# & VB) to help beginners with ASP.NET.
11/26/2008 2:02:00 AM

What I meant was create a new .aspx with name GetImage.aspx

So, when you call the page like this GetImage.aspx?OriginalImagePath=images/Picture.jpg

In the Page_Load of GetImage.aspx you can get the path of your original image by QueryString("OriginalImagePath") and use that to create the thumbnail and write the thumbnail image to the page.

This way OriginalImagePath=<file name> will be dynamic and GetImage.aspx?OriginalImagePath=<file name> should work of any image and not just Picture.jpg

Remember to select "Mark as Answer" on the post that helped you find the solution!
11/26/2008 3:09:21 AM


Thanks for you help!  I'll take a shot at this later today. 

If I understand this correctly, the file GetImage.aspx would always have the last image processed in it until the next one came along, and may we could think of it as a sort of cousin to a subroutine or a function (sorry if there is a word for this general class and I just haven't come across it yet, lol)

 Best regards,



Larry Dechent - Sampson Coatings has 29 examples (C# & VB) to help beginners with ASP.NET.
11/26/2008 9:17:22 AM

Similar Artilces:

How to Insert Image Url and Display the Image of that Image Url in the Grid View?
Any one can help me out about this- How to Insert Image Url and Display the Image of that Image Url in the Grid View Hi You can add HyperLink control to Gridview by setting its ImageUrl and NavigationUrl property Please refer example. <asp:HyperLink ID="HyperLink1" ImageUrl="images/image.gif" NavigateUrl="PageUrl.aspx" runat="server">HyperLink</asp:HyperLink>Please mark the post as answered if it helped you. Hi sandynaidu, This is easy to solve. Assuming that your GridView's ID is gv, that you want to have the image in your firs...

Can you dynamically set the image url in a mobile form mobile image ?
I am testing mobile forms, I have created a mobile form with a mobile image. <mobile:Image ID="Image6" Runat="server"   ImageUrl="<%#Prodphoto%>" >  I would like to set the image based on the selected value as follows private string _prodphoto;    public string Prodphoto    {        get        {            return _prodphoto;        } ...

how to save image on server and add image url to database for display on web page
I am trying to figure out how to allow a user to insert a new record into the database with the option of adding an image to the item.  The picture would then be saved on a web server and the link to the picture would be saved in a column of the table.  I would then need to display the picture along with its other information such as a description when the user selects the record from a drop down list on the page.  I have been searching everywhere and cannot find a good guide to help me accomplish this.  Can someone please help me?   There are a bunch of starter k...

display image in a image image button
hi   i have to display an image in image button while uploading mycode Image1.ImageUrl = Upload.PostedFile.FileName; is not working thanks Hi You need to save the PostedFile to the disk on the server and then assign it to ImageUrl. Take a look at the following links for more infoprmation on how to do this. Nassabehwww.professionalcsharp.comDon't forget to click "Mark as Answer" on the post that helped you. That way ...

How i can display image on C# web form through ms-access
Hi All!! I'm using following code to display my image on web page. Image is stored in database as OLE object unser "img_stream" variable.private void Page_Load(object sender, System.EventArgs e)            {                  // Put user code to initialize the page here                  myAccessConnection = new OleDbConnection(connStr);   &nb... problem: i can not view image data for the rest of my table rows except the image for the first row but i can read all the other non image fields for all rows.
Hi i have a table with the following fields imgdata........image imgtitle.........varchar(max) imgType........varchar(max) imgLength.....bigint i have no problem with uploading the image but viewing the uploaded image(s) in a gridview has caused me great pain. The probelm is i have two pages. page1 grabs the image to display and page2 has a gridview that displays the grabed image. I wanted to have an sql statement like SELECT * FROM mytable WHERE incident_id=someValue. IF i have 5 records in this table and i view page2 ...

How can i use javasrcipt or xmlhttprequest to get the image outputed by an web page?
How can i use javasrcipt or xmlhttprequest to receive the image outputed by an web page? the webpage like this  protected void Page_Load(object sender, EventArgs e)    {        string strQueryFileName = Request.QueryString["filename"];         string strLocalPath = Server.MapPath(path);        Bitmap  theReturnImage = new Bitmap(strLocalPath);         theReturnImage.Save(ms, ImageFormat.Jpeg); &n...

How to Insert the Image URL into Sql database and display that particular Image of the URL in GridView
 How to Insert the Image URL into Sql database instead of storing the original image itself and display that particular Image of the URL dynamincaly in GridView.For example for each product there will be one image ,here i want to store that Image URL (locally/in other Links) into the Sqldatabase and on selecting foran particalur product id i want it to display that image of the product in Grid View.How can i proceed........?i am seeking for help.   If I understood you question this is not very hard 1.  Created a table id, description and ImgUrl.  The ImgUrl field ...

Web custom Control - can't acces image url in Resources folder
 I'm working on a custom web server control that is suppose to give information on a doctor.  The final goal is to place the control in a hover extender panel, so when you hover over the doctor picture, this control pops up, and play a recording of there voice introducing themself. I'll get to the sound part this weekend.So far, it seems that all of the references I search are examples for aspx pages. The line in bold are confusing me.This is a class dll project named teamRoster Right now, I'm trying to access a image in the resource folder called BalloonPointer1.g...

How to use an alternate image url if first image url can't be found
 Hello,I have a product detail page that pulls in a picture and some product details for a product when a user clicks a link in a gridview on another page.  The image files have names like: 1000k.jpg, but for some products the img file names are like: 1000w.jpg.  I want to be able to look for the "w" version if the "k" version can't be found.  I was able to solve a similar problem with product detail text files by using "error catching", but since the inability to find an image url doesn't raise an error, I'm at a loss as to how I...

Getting images from db and displaying in WebControls.Image
So I have the following code which is getting my image, but unfortantly all that is displayed is a 'x' where the Image controls is placed.  In the main aspx.cs page:1 //get the image in bytes from the database 2 byte[] imageInBytes = image.LoadImage(Convert.ToInt32(dr.ItemArray[3])); 3 4 //place in memory stream 5 System.IO.MemoryStream memoryStream = new MemoryStream(imageInBytes, 0, ...

BUG: Image Controls in UpdateProgess Control: Can not use FindControl() methods to get Image
There is a single UpdateProgress control on the page. as such: <ajax:UpdateProgress  ID="UpdateProgress1" runat="server"   DisplayAfter="100" >         <ProgressTemplate>                <div style="border:2px solid #0099FF; background-color:#EFEFEF; padding:10px; width:200px; height:20px;">               Updating Panel            </div&...

Reading in an image from the web and getting image type
Hi,   I am trying to stream in images from the web and then convert them to byte[] and then plug them into a database "image" field.  I basically have it working but in the end the image is messed up for some reason.  Here is my code:  byte[] returnVal = null;  Stream ImageStream = new WebClient().OpenRead(pageUrl);  int count = 0;while (ImageStream.ReadByte() != -1) count++;   ImageStream.Close();  Stream ImageStream2 = new WebClient().OpenRead(pageUrl); //where pageUrl is the url to the image file  byte[] temp = new byt...

Displaying images in a DW (Getting image dimensions)
PB9.0 Hi all. Can some one help me with the following please: - I want to display an image in a dw. The user types the path and name of the file to be displayed in a text box. I then need to display this in the image object in the DW (this I can do), the problem is the image is being distorted based on the sixe of the image object. How do I get the dimensions of the actual image (could be a bmp, gif or jpg file) so I can set the image object size just prior to loading ? Thanks You could purchase a 3rd party DLL that has functionality to read the file's dimensions. A chea...

Web resources about - Can I display an image without getting the image from a URL? -

Samples of display typefaces - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Smiley faces and rough tactics on display as China puts Pu Zhiqiang on trial
Prominent lawyer Pu Zhiqiang faced trial in Beijing on Monday, as police and plain-clothes security officials manhandled foreign media trying ...

Facebook app will soon display new content & allow comments even when you’re offline
... of features that should help. The first is caching posts that have been downloaded but not yet viewed. When you’re offline, the app will display ...

StarTech Launches USB Docking Station With UHD Display Support
... class docking station, the fact is that most laptops don’t offer any sort of docking solution. The new docks are the USB3VDOCK4DP (4K DisplayPort), ...

HTC One A9 update adds extra AMOLED display color profiles
AMOLED color reproduction is a somewhat controversial subject. Fans of the organic display applaud it's vivid colors and inky blacks, while detractors ...

Duet Display can now turn any iPad Pro into a perfect second screen for a Mac or PC
... of the best features of the iPad Pro isnt hard to see. The 12.9-inch screen is the biggest iOS device ever and as large as many MacBook displays. ...

WSJ: Samsung Galaxy S7 to have pressure-sensitive display, microSD slot
... features to entice upgraders. The biggest news, according to the Journal , is that the S7 and S7 Edge will feature a "pressure-sensitive display" ...

Raunchy, ISIS-themed Xmas display gets cops' attention
York County sheriff says a concerned resident notified the office of a potential "ISIS sympathizer," but that wasn't quite the case

Samsung Galaxy S7 goodies could include pressure-sensing display
Next year's version of Samsung's marquee smartphone could also come with a fast charging port and maybe even a retina scanner, says the Wall ...

Galaxy S7 likely to get pressure-sensitive display and high-speed charging
Samsung will add a pressure-sensitive display and high-speed charging port to the upcoming Galaxy S7, according to a report on Monday. The vendor ...

Resources last updated: 12/14/2015 7:11:57 PM