473,395 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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 8913
"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
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
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
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
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
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
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
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
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
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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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
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...

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.