Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Export Images from an Image List in VS2005?

Tags:

.net

imagelist

Using Visual Studio 2005, is there a way to export the images in an Image List to individual files on my PC? Using the IDE, I select the Image List and view its properties. In the "Images" property, I launch the Images Collection Editor dialog. I can only add and remove images, but I cannot find a way to export an image that is already in the list.

Why? The developer who made the original list has left our company and I need the images for an ASP.NET application (will convert to .jpeg).

Thank you for the help!

like image 971
cbuck12000 Avatar asked Nov 13 '09 14:11

cbuck12000


2 Answers

You can write some simple code to export the images. You don't mention which language you are using, so here is the solution in both C# and VB.

C#

for (int x = 0; x < imageList1.Images.Count; ++x)
{
    Image temp = imageList1.Images[x];
    temp.Save("image" + x + ".bmp");
}

VB

For x As Integer = 0 To imageList1.Images.Count - 1
    Dim temp As Image = imageList1.Images(x)
    temp.Save("image" & x & ".bmp")
Next
like image 170
Jason Berkan Avatar answered Sep 23 '22 05:09

Jason Berkan


On codeproject there is example application how to do this.

I've created a new version from Embedded Image Grabber which supports:

  • png images
  • jpg images
  • gif images
  • Save all images at once to a folder

SourceCode can be found here.

like image 26
Stef Heyenrath Avatar answered Sep 24 '22 05:09

Stef Heyenrath