Mayank Jani

Mayank Jani

  • NA
  • 477
  • 76.7k

How to save images to a folder with its original name?

Apr 11 2019 1:19 PM
Hello members,
 
Greetings of the day....
 
I am working on a C# WinApp. I am preparing my picture album uploading and viewing app. I have two queries...
1. How to save the image with its original name?
my code line for doing so is... pbImages.Image.Save(@"D:\Images\MyAlbums\Picture.jpg");
obviously, it will save the image with name 'Picture' but the problem is when I save another image it overwrites the first image and gives the same name 'Picture' to the second image.
Is there any way to copy the name at the time of selecting the image from OpenFileDialog box and give it to the image when saved? or any other way to save pictures as P1, P2, P3... so on whichever is easier.
 
2.How to maintain the picture quality when retriving the image to picture box?
I use ListView to see all the saved images with help of ImageView, when i select an image from ListView to load into the PictureBox, it gets blurred. I do not know why it happens... I have checked to change the color depth but no change happned.
let me tell you one thing, I reduce the picture size according to the size of the picture box. when I see the image in normal way (i.e. in Windows Photo Viewer) it appears good but when load in picture box, it gets blurred.
 
Please help me .
 
Thanks a lot
 
Mayank Jani.

Answers (22)