473,609 Members | 2,212 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 8945
"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
3172
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: imageList.Images, I get
2
8524
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 in .net(forms application) by chnging one trckbar(like tb1->Value),
4
2191
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 - 1
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
2630
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 images are changed then index of image may be no more same as referenced in the code, so name would...
0
1388
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
3361
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 file. Is it possible to "embed" the image from the gridview into the excel workbook so I could give...
2
3555
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 instead of simply returning a reference. Needless to say, we were a bit surprised and disturbed to...
0
2117
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) Handles MyBase.Load Dim gp As Acrobat.CAcroApp Dim gpdoc As Acrobat.CAcroAVDoc gp =...
0
8111
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8044
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8548
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8510
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6973
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4006
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2509
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 we have to send another system
1
1635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1372
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.