473,549 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ 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 8936
"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.I mages.Count - 1
Me.ImageList1.I mages(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.I mages.Count - 1
Me.ImageList1.I mages(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.ImageListT oFiles(Me.Image List1, "C:\test\",
System.Drawing. Imaging.ImageFo rmat.Jpeg)

Module:

Public Module Util
Sub ImageListToFile s(ByVal list As ImageList, ByVal rootDirectory As
String, ByVal format As System.Drawing. Imaging.ImageFo rmat)
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(rootDir ectory & 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.ImageListT oFiles(Me.Image List1, "C:\test\",
System.Drawing. Imaging.ImageFo rmat.Jpeg)

Module:

Public Module Util
Sub ImageListToFile s(ByVal list As ImageList, ByVal rootDirectory As
String, ByVal format As System.Drawing. Imaging.ImageFo rmat)
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(rootDir ectory & 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******** ********@tk2msf tngp13.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.I mages.Count - 1
Me.ImageList1.I mages(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******** ********@tk2msf tngp13.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.I mages.Count - 1
Me.ImageList1.I mages(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******** ********@tk2msf tngp13.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.I mages.Count - 1
Me.ImageList1.I mages(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
3156
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 current panel status (Open/Close). Problem is that in certain complex scenarios the images disappear! from the ImageList. That is, when I call:...
2
8509
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 like "gcnew is undeclared error",how to deeclare 'gcnew" and when i am using in runtime to change the size of images in imagelist in listview control...
4
2186
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: Win32.Shell.SHGetFileInfo(NodePath, 256, fileinfo, cbFileInfo, flags) tvFolders.ImageList.Images.Add(Icon.FromHandle(fileinfo.hIcon)) tn.ImageIndex = tvFolders.ImageList.Images.Count...
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
2627
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 pic.Image = ImageList1.Images(1) ? I'd like to retrieve images of the imagelist by name instead of image index number because if order of those...
0
1385
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: for(int i = 0; i < openFileDialog1.FileNames.Length; i++) {
1
3357
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 problem is, the image won't display unless I'm connected to the Internet or if I use a relative path and have the image stored relative to the excel...
2
3547
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 was causing memory spikes. After several hours we discovered that the ImageList.Images indexer is actually returning a copy of the added Images...
0
2113
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 browser window. Could you please advice me. I pasted my code below. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)...
0
7520
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7450
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7720
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7957
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7470
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7809
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6043
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5368
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
763
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.