-3

I am using Aforge.net samples and i wanted to get name of the images which are placed on resources. I am unable to do so as image.tag is givng an error.

Please help

Muneem Habib
  • 1,046
  • 4
  • 18
  • 49
  • try this http://forums.asp.net/t/1774226.aspx/1 – Mogli Mar 28 '13 at 11:35
  • 1
    @Sherlock you can't help. We need psychic here, not detective;) – Dmitrii Dovgopolyi Mar 28 '13 at 11:35
  • I have an image named stop.png. I have loaded this image into resourceBitmap img1 = new Bitmap(Properties.Resources.Stop); i wanted to get name of the image i.e i wanted to get stop does this make any sense? – Muneem Habib Mar 28 '13 at 11:43
  • @user2174920 its impossible to achive that you are asking about. `Bitmap` class have inside only image binary data and knows nothing about the place from which this data was loaded – Anton Semenov Mar 28 '13 at 14:06

1 Answers1

0

You can using the Uri Class to load the path and pull the Image name from Segments collection:

Uri uri = new Uri("http://www.XXXX.com/imageName.jpg");
string fileName = uri.Segments.Last();

Edit

Let see this answers: if you like it ?

C# how to get a bitmap from a picturebox

Get bitmap file name

New Edit

System.IO.FileInfo info = new System.IO.FileInfo(Properties.Resources.Stop);
string fileName = info.Name;
Community
  • 1
  • 1
Ramesh Rajendran
  • 37,412
  • 45
  • 153
  • 234
  • I have an image named stop.png. I have loaded this image into resourceBitmap img1 = new Bitmap(Properties.Resources.Stop); i wanted to get name of the image i.e i wanted to get stop does this make any sense? – Muneem Habib Mar 28 '13 at 11:41
  • Thanks for your reply. The links which you have given above shows how to change names of image files. I wanted to display the names of image file in a textbox or label – Muneem Habib Mar 28 '13 at 12:07
  • You get no help from Bitmap, it doesn't keep track of a file name. Nor does a Bitmap have to be created from a file, it has several constructors. You'll need to keep track of this yourself with a string variable. – Ramesh Rajendran Mar 28 '13 at 12:12
  • is there any way to get name of image file and display it in textbox? – Muneem Habib Mar 28 '13 at 12:20