CrImage::ICO::Icon
Inherits Reference / Object
Represents an ICO file with multiple icon sizes
ICO files can contain multiple images at different resolutions. This class provides convenient access to all images and their metadata.
Example
icon = CrImage::ICO.read_all("favicon.ico")
puts "Contains #{icon.images.size} sizes"
# Get specific sizes
largest = icon.largest
smallest = icon.smallest
icon_32 = icon.find_size(32, 32)
Constructors
Instance methods
Finds the icon closest to the specified dimensions
Returns the image whose total pixel count is closest to the target size. Useful for selecting appropriate icon for display.
icon = CrImage::ICO.read_all("favicon.ico")
# Get icon closest to 40x40 (likely returns 32x32 or 48x48)
best_fit = icon.find_size(40, 40)
largest
Returns the largest icon by pixel count
icon = CrImage::ICO.read_all("app.ico")
largest = icon.largest # Returns 256x256 if available
smallest
Returns the smallest icon by pixel count
icon = CrImage::ICO.read_all("favicon.ico")
smallest = icon.smallest # Returns 16x16 if available