How can I extract an image of a specific size or all images from an icon with multiple images?
You can open the MSI with Orca tool, go to this table, and double click the "Data" column, you will then be prompted with option to export the resource or even overwrite it. Show activity on this post. Try decompressing it with 7-zip or The Unarchiver (on OS X). Decompressing the .
To resize desktop icons, right-click (or press and hold) the desktop, point to View, then select Large icons, Medium icons, or Small icons.
You don't say what the purpose of this is, and there are a number of ways of getting icons and one method may be better than another depending on the purpose.
However, to extract any number of "large" (32x32) and/or "small" (16x16) icons* from an arbitrary file, use the ExtractIconEx
function. This lets you extract one or more icons of either of these two standard sizes from an icon file (.ico), EXE, or DLL. An icon file can contain multiple images and this function will let you get all of them.
The function will write to an array of handles, each of which you can assign to the Handle
property of a TIcon
instance. Then you can use the TIcon
methods as you normally would if you'd loaded the TIcon any other way. Note that new to Delphi XE is the ability to copy it easily to a bitmap via the Assign method. That article also shows how to access all of the stock (inbuilt / standard) Windows icons, if that happens to be what you're after.
(Side note: I think the TIcon
class lets you load from a file via its LoadFromFile
method - this seems to be missing from the documentation, but I'm pretty certain it exists. From memory, that only loads a single icon.)
(*) Actually, "large" and "small" can be different to 32x32 and 16x16: use the
GetSystemMetrics
function with theSM_CXICON
,SM_CYICON
,SM_CXSMICON
, andSM_CYSMICON
flags to find out the dimensions of each type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With