Is there a way to find the size of an icon in bytes..?

The file with the extension .ico stores the icons and it has a
directory field which tells the bytes occupied by the icon's data.
But the question is that how can we extraxt the information?
is there ant software or some built in
fuctionality in xp through which we can access this information??
plz help...

Dani AI

Generated

Building on 's question and 's Resource Hacker suggestion: there are two practical paths depending on whether you have a standalone .ico file or an icon embedded inside an EXE/DLL.

For a .ico file you can read the ICO header directly — the format stores one 6‑byte ICONDIR followed by 16‑byte ICONDIRENTRY records; each entry contains a 4‑byte little‑endian bytesInRes value that gives the exact byte size of that image. The quickest scriptable way on Windows is PowerShell; the snippet below reads each directory entry and prints its bytesInRes:

$path = "C:\path\to\file.ico"
$bytes = [System.IO.File]::ReadAllBytes($path)
$count = [System.BitConverter]::ToUInt16($bytes, 4)
for ($i=0; $i -lt $count; $i++) {
  $entryOffset = 6 + ($i * 16)
  $bytesInRes = [System.BitConverter]::ToUInt32($bytes, $entryOffset + 8)
  Write-Output ("Icon {0}: {1} bytes" -f ($i + 1), $bytesInRes)
}

Notes and caveats: the script above works on standalone .ico files only. Icons embedded in PE files use RT_GROUP_ICON/RTICON resources and must be inspected with a PE/resource tool (Resource Hacker, Resource Tuner, ResEdit) or extracted programmatically via the Win32 resource APIs — Resource Hacker (GUI) is the simple route that recommended. Windows Explorer shows the overall file size but not per-icon resource sizes. For the ICO format specification and field offsets used above, see the ICO file format reference (format notes and examples) at [ICO (file format)](https://en.wikipedia.org/wiki/ICO(file_format)). For a quick GUI extractor see Resource Hacker.

Recommended Answers

All 3 Replies

Resource Hacker. Find the icon or bitmap in the library, and RH will show you that image plus the byte size.

Can u tell me where is the library of icon as i want to know the size of windows icons. I know a file acwizard.ico in vista which stores the icons.
And plz tell, what is RH?

RH is resource hacker. Easy to find on the net.
Unzip to a new folder, dclick the .exe to start it, and drag the windows file into it to open it. Two files with icons are explorer.exe and shell32.dll. There are resources on the web which detail the icons in those files.
Good luck.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.