473,484 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Export ImageList images

Hi,
does anyone have a sub for exporting the images (all or selected) of an
imagelist as files?

TIA
Kejpa
Nov 21 '05 #1
7 8919
"Kejpa" <kS*******@saj.fi> schrieb:
does anyone have a sub for exporting the images (all or
selected) of an imagelist as files?


\\\
Dim i As Integer
For i = 0 To Me.ImageList1.Images.Count - 1
Me.ImageList1.Images(i).Save(i.ToString & ".bmp")
Next i
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #2
"Kejpa" <kS*******@saj.fi> schrieb:
does anyone have a sub for exporting the images (all or
selected) of an imagelist as files?


\\\
Dim i As Integer
For i = 0 To Me.ImageList1.Images.Count - 1
Me.ImageList1.Images(i).Save(i.ToString & ".bmp")
Next i
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 21 '05 #3
Hi Kejpa

Try this for starters:

You would want to add in checking for the directory existing, and handle
file extensions better - but you get the idea.

HTH

Nigel

Code to use the module:

Util.ImageListToFiles(Me.ImageList1, "C:\test\",
System.Drawing.Imaging.ImageFormat.Jpeg)

Module:

Public Module Util
Sub ImageListToFiles(ByVal list As ImageList, ByVal rootDirectory As
String, ByVal format As System.Drawing.Imaging.ImageFormat)
Dim i As Integer = 0
For Each im As Image In list.Images
' format.ToString is a bit of a hack...you would probably want to
' do a Select Case on it to get more control over the file
extension
im.Save(rootDirectory & i & "." & format.ToString(), format)
i += 1
Next
End Sub
End Module
"Kejpa" wrote:
Hi,
does anyone have a sub for exporting the images (all or selected) of an
imagelist as files?

TIA
Kejpa

Nov 21 '05 #4
Hi Kejpa

Try this for starters:

You would want to add in checking for the directory existing, and handle
file extensions better - but you get the idea.

HTH

Nigel

Code to use the module:

Util.ImageListToFiles(Me.ImageList1, "C:\test\",
System.Drawing.Imaging.ImageFormat.Jpeg)

Module:

Public Module Util
Sub ImageListToFiles(ByVal list As ImageList, ByVal rootDirectory As
String, ByVal format As System.Drawing.Imaging.ImageFormat)
Dim i As Integer = 0
For Each im As Image In list.Images
' format.ToString is a bit of a hack...you would probably want to
' do a Select Case on it to get more control over the file
extension
im.Save(rootDirectory & i & "." & format.ToString(), format)
i += 1
Next
End Sub
End Module
"Kejpa" wrote:
Hi,
does anyone have a sub for exporting the images (all or selected) of an
imagelist as files?

TIA
Kejpa

Nov 21 '05 #5
It's that simple...
I'm embarrased.

Thanx a lot!
/Kejpa
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"Kejpa" <kS*******@saj.fi> schrieb:
does anyone have a sub for exporting the images (all or
selected) of an imagelist as files?


\\\
Dim i As Integer
For i = 0 To Me.ImageList1.Images.Count - 1
Me.ImageList1.Images(i).Save(i.ToString & ".bmp")
Next i
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #6
It's that simple...
I'm embarrased.

Thanx a lot!
/Kejpa
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"Kejpa" <kS*******@saj.fi> schrieb:
does anyone have a sub for exporting the images (all or
selected) of an imagelist as files?


\\\
Dim i As Integer
For i = 0 To Me.ImageList1.Images.Count - 1
Me.ImageList1.Images(i).Save(i.ToString & ".bmp")
Next i
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #7
Hmmm,
back at the office after a short cold and I try your code but it won't work
with icons. I can export the images as bmp's but then I loose the
transparent part. :(

any ideas?

TIA
/Kejpa
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
"Kejpa" <kS*******@saj.fi> schrieb:
does anyone have a sub for exporting the images (all or
selected) of an imagelist as files?


\\\
Dim i As Integer
For i = 0 To Me.ImageList1.Images.Count - 1
Me.ImageList1.Images(i).Save(i.ToString & ".bmp")
Next i
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3146
by: A. Solomon | last post by:
Hi, I have a ImageList containing 4 bitmaps attached to a UserControl which acts as a Open/Close panel. This panel, upon click, switches the image in a PictureBox control to indicate the...
2
8497
by: Sanjeeva Reddy | last post by:
hai Anti Keskinen, i have used the following code MyListView->LargeImageList->ImageSize = gcnew System::Drawing::Size(100, 100); // Sets large image size to 100, 100 here i am getting error...
4
2180
by: Just Me | last post by:
If I add an image to an imagelist using imageList.Images.Add... And use it with a tree node tn.ImageIndex = imageList.Images.Count-1 This is the actual code:...
0
313
by: Kejpa | last post by:
Hi, does anyone have a sub for exporting the images (all or selected) of an imagelist as files? TIA Kejpa
1
2618
by: Mika M | last post by:
Hi! I'm wondering is it possible to give names for the images in the imagelist somehow, and retrieve those images when needed by using code like pic.Image = ImageList1.Images("Save") instead of...
0
1379
by: Luis Arvayo | last post by:
Hi, When I add an image dynamically at runtime to an ImageList, the image is added but with the problem that all the images are added with black pixels surrounding them. Example code: ...
1
3350
by: edwinparker | last post by:
Hi, I'm trying to convert a gridview to an excel report and have one small hang up. So far I've been able to create my gridview and export it to excel ok, but in my gridview I have an image. The...
2
3534
by: =?Utf-8?B?S2VuTg==?= | last post by:
We're using a System.Windows.Forms.ImageList to store a bunch of Images that I've loaded, and rendering each image in the ImageList during a draw loop. The process was running unusually slow and...
0
2107
by: Mariaprabudass E | last post by:
I need to extract images from pdf file. There is option in Acrobat 8.0(Advanced-->Document Processing-->Export All images). I tried to automate that process. But i could not know how to close the...
0
7082
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6953
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6813
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7214
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5407
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4845
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3046
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3041
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1359
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.