Icon --> Image (BMP)

BlitzPlus Forums/BlitzPlus Beginners Area/Icon --> Image (BMP)

SebHoll(Posted 2005) [#1]
Quick question,

Does anybody know how to convert an icon (given as a preloaded Icon handle [from using ExtractIcon() function]) to a BMP file. I tried drawing the icons onto a canvas and then saving the canvas' buffer using "SaveBuffer()" but it isn't including the icons in the picture. It's as if the icons are on a seperate layer above the window? I've seen posts explaining how to do from Image --> Icon but not the other way round.

Any suggestions?

Seb


CS_TBL(Posted 2005) [#2]
If you can't save the canvas .. try 'capturing'/getpixel() the icon when using the desktopbuffer() ..


Grisu(Posted 2005) [#3]
As CS said, try readpixelfast and writepixelfast the image to a separate image handle. Which you can then save as BMP, etc.


SebHoll(Posted 2005) [#4]
Still doesn't work. The only why I've found where I can get the icons to appear on a Blitz buffer is by drawing the icons onto the screen and using "DesktopBuffer()" and capturing the area of the desktop buffer with the image in. The only problem with this method is that the size of the image is limited to the size of the desktop. I am trying to make a function which generates a BMP iconstrip from a set of .ICO files. It works fine with less than 32 icons (on a 1024x768 monitor: one line of 32x32 icons (1024/32 = 32). But anymore than that it tries to read off of the side of the screen and fails. I suppose I could script it to do multiple rows but that is ineffecient and I don't like the idea of using a desktop buffer as it doesn't seem right. Surely there must be a better way???


CS_TBL(Posted 2005) [#5]
hm..

Those icons, did you make them yourself (in Photoshop for example), if yes: can't you save them as BMP yourself so you'd have 2 kinds of images: BMP's and ICO's?

I mean, I fail to see the purpose of that whole thing you want.. :)


SebHoll(Posted 2005) [#6]
.


SebHoll(Posted 2005) [#7]
I've managed to find a way to do it... It's still not probably the best way but it will do for now. I make a canvas on a new form and draw each icon, one at a time, to the canvas. I then save the Desktop buffer, copy the portion of the desktop buffer where the icon is into a new image, delete the canvas (removing the icon from the screen) and move onto the next one. I then save the image buffer as a file on the local HDD, and load the icon strip into the List Box.

Thanks for you suggestions anyway

Seb