← Asset catalogs
Assets.car·Format guide
All tools

Compiled asset catalogs (Assets.car)

An app's Assets.xcassets folder — image sets, app icons, colors, data sets, symbols — is compiled by Xcode's actool into one file, Assets.car, which UIKit and AppKit read through Apple's private CoreUI framework (UIImage(named:), UIColor(named:), NSDataAsset(name:)). The format is undocumented. This guide describes it as the tool reads it: what others worked out (Timac's “Reverse engineering the .car file format”, cartool, acextract, AssetCatalogTinkerer) and what was checked against Apple's own assetutil --info on catalogs written by actool and on the system's.

Contents

  1. The BOM container
  2. The catalog's tables
  3. Rendition keys and attributes
  4. Renditions: the CSI header
  5. Resources
  6. Rendition data: bitmaps, raw data, colors…
  7. Bitmap compression
  8. LZFSE and LZVN
  9. What to look for
  10. What the tool shows, and its limits
  11. The libraries

1The BOM container

An Assets.car is a BOM file (“bill of materials”, from NeXTSTEP; macOS installer receipts and .bom files in packages use it too). Its own numbers are big-endian; the catalog's data inside the blocks is little-endian.

OffsetSizeField
08BOMStore
8 · 124 eachversion (1) · number of block slots
16 · 204 eachoffset and length of the block index: a count, then (offset, length) for each block id; then a free list in the same form
24 · 284 eachoffset and length of the variables: a count, then (block id, name length, name) — the named entry points

The header takes 512 bytes. A variable either points to a plain block or to a B-tree: a block tree, version, the root page's block, the page size (4096 or 1024), the number of entries and a byte. A page is (isLeaf 16 bits, count 16 bits, forward, backward) and count pairs (value block, key block). In a leaf they are an entry's value and key; in a branch, a child page and the key that ends it, plus one uncounted last child. Leaves are chained by their forward links. The asset catalog's BITMAPKEYS tree stores a number in the key field instead of a block id.

2The catalog's tables

VariableWhat it holds
CARHEADER436 bytes: CTAR, the CoreUI version, storage version, a timestamp, the rendition count, the main version string (128 bytes, CoreUI's), the version string (256 bytes, e.g. “Xcode 27.2 (27B52) via AssetCatalogAgent”), a UUID, a checksum, the schema version, the color space and the key semantics.
EXTENDED_METADATAMETA and four 256-byte strings: thinning arguments, deployment target, platform (ios, macosx, watchos, appletvos, xros…), authoring tool (CoreThemeDefinition's version).
KEYFORMATkfmt, a version, a count, then the attribute numbers of a rendition key, in order.
FACETKEYSTree: an asset's name → a hot spot (two 16-bit numbers), a count and (attribute, value) pairs — element, part and the identifier that the renditions of that name carry in their keys.
RENDITIONSTree: a rendition key (one 16-bit value per key-format attribute) → a CSI rendition. One asset name has a rendition for each scale, idiom, appearance, language… it was given.
APPEARANCEKEYS · LOCALIZATIONKEYSTrees: an appearance name (UIAppearanceDark, NSAppearanceNameDarkAqua…) or a language → the 16-bit number used in keys.
BITMAPKEYSTree: a name identifier → one 32-bit number per key attribute, apparently a set of bits of the values that name's renditions use (−1 for all); its exact meaning isn't known.
othersOlder and system catalogs can have COLORS, FONTS, FONTSIZES, GLYPHS, BEZELS, PART_INFO, ELEMENT_INFO, EXTERNAL_KEYS…; the tool lists their entries as they are.

3Rendition keys and attributes

The attribute numbers, with CoreUI's names (kCRTheme…Name, as assetutil prints the key format). Attributes a catalog doesn't use are left out of its key format; 0 usually means “any”.

#AttributeValues
1 · 2element · partthe kind of asset: element 85 is an asset catalog's, element 9 the packed images; part 181 images and data, 220 app icons, 217 colors
7appearancea number from APPEARANCEKEYS (0: any)
8 · 9dimension 1 · 2used by actool for the slot of an app icon's size, among others
12scale1, 2, 3 (0 for vectors and data)
13localizationa number from LOCALIZATIONKEYS
15idiom0 universal, 1 phone, 2 pad, 3 tv, 4 car, 5 watch, 6 marketing, 7 mac, 8 vision
16subtypea screen size, e.g. 568 for 4-inch iPhones
17identifierthe name, through FACETKEYS
20 · 21horizontal · vertical size class0 any, 1 compact, 2 regular
22 · 23memory · graphics classdevice memory and Metal GPU family (app thinning)
24display gamut0 sRGB, 1 Display P3
25deployment targetrenditions for newer OS releases (0 any)
26 · 27glyph weight · sizeSF Symbols-style vector glyphs: ultralight … black; small, medium, large
3, 4, 6, 10, 11, 14, 18, 19size, direction, value, state, layer, presentation state, previous value, previous statethe AppKit theme's attributes (system catalogs)

4Renditions: the CSI header

Each rendition value starts with a 184-byte header, then resources length bytes of resources, then the data.

OffsetSizeField
04ISTC on disk (the code CTSI, little-endian)
4 · 84 eachversion (1) · flags: bit 2 vector based, 3 opaque, 4–7 bitmap encoding, 8 opts out of thinning, 9 flippable, 10 tintable, 11 preserved vector representation (from Timac's write-up)
12 · 16 · 204 eachwidth · height in pixels · scale × 100
244pixel format: ARGB, RGBW (assetutil's ARGB-16), GA8, GA16, RGB5, PDF, SVG, DATA, JPEG, HEIF
284color space (low 4 bits): 0 generic, 1 sRGB, 2 gray gamma 2.2, 3 Display P3, 4 extended sRGB, 5 extended linear sRGB, 6 extended gray
32 · 36 · 384 · 2 · 2modification time · layout · 0
40128the rendition's name: the source file name (logo@2x.png), CoreStructuredImage for data sets
168 · 172 · 176 · 1804 eachresources length · 1 · 0 · data length

The layout says what the rendition is: 10–12 a one-part image (fixed, tiled, scaled), 20–25 three-part, 30–34 nine-part images (sliced, resizable), 40 six-part, 50 an animation filmstrip, 6 gradient, 7 effect, 9 a vector (PDF or SVG), 1000 data, 1001 external link, 1002 layer stack, 1003 a reference into a packed image, 1004 a packed image (actool packs small images into atlases named ZZZZPackedAsset-…), 1005 name list, 1007/1008 textures, 1009 color, 1010 multisize image set (app icons), 1012 layer reference, 1013 content rendition, 1014 recognition object, 1015–1018 models, 1017 vector glyph (symbols), 1019 icon image stack, 1020 icon group, 1021 named gradient (the layered icons of recent systems). The names of the less common layouts come from the reverse-engineered write-ups; assetutil's AssetType agrees with them where it prints one.

5Resources

Tag, length, value records (all 32-bit little-endian):

TagWhat it holds
1001slices: a count, then (x, y, width, height)
1003metrics: a count, then insets and the image size (JPEG renditions have their size only here)
1004composition: blend mode and opacity (a float)
1005UTI: a length, 0, then the type identifier (public.json…) of a data set
1006 · 1007EXIF orientation · bytes per row of the bitmap
1010packed-image reference: INLK, 0, the frame (x, y, width, height — from the bottom-left corner), the layout, a length, then the packed image's key as (attribute, value) pairs ending with (0, 0)
1012, 1018–1022layer references, vector glyph metrics and information, icon layer properties (shown in hex)

6Rendition data

Tag on diskWhat it is
MLEC (CELM)A bitmap: flags, compression, length, then the data. When the data starts with KCBC the length is a number of chunks, each KCBC, 0, 0, a number of rows and a length, compressed on its own (big images are split in bands of rows). Pixels: ARGB is premultiplied BGRA bytes; RGBW premultiplied RGBA as 16-bit floats (extended range); GA8 premultiplied gray and alpha bytes. Rows are top down and may be padded (resource 1007).
DWAR (RAWD)Raw data: flags (bit 0: LZFSE-compressed), a length, then the bytes — a PDF, an SVG, a JPEG, a data set's file.
RLOC (COLR)A color: version, color space (low byte), a count, then the components as 64-bit floats (red, green, blue, alpha; gray and alpha).
SISM (MSIS)A multisize image set (an app icon): version, a count, then (width, height, index, idiom) — the idiom stored is 0 where assetutil shows the key's.
ARGG (GGRA)A named gradient: stops that refer to named colors (shown in hex).

7Bitmap compression

#Name (assetutil's)Here
0uncompresseddecoded
1rlenot decoded (an undocumented run-length format with a table of row offsets; rare)
2zipdecoded: actool writes gzip members (--optimization space)
3 · 4lzvn · lzfsedecoded (app icons and large images; packed images on macOS)
5jpeg-lzfsenot decoded (“GPU smallest” on macOS)
7astcnot decoded: an LZFSE-compressed .astc texture, which can be saved (“GPU best/smallest” on iOS)
8palette-imgnot decoded: LZFSE data starting with 0D F0 FE CA, a palette of premultiplied ARGB colors, then packed indices in an undocumented order (older deployment targets)
9hevcnot decoded: a HEIF image, which can be saved as .heic (“lossy”, and packed images of recent systems)
10 · 11deepmap-lzfse · deepmap2not decoded: Apple's undocumented lossless image format (dmap/dmp2 with LZFSE inside); what actool writes for most images today
12dxtcnot decoded: an LZFSE-compressed DXT texture (“GPU best” on macOS)

On today's catalogs most small images are deep map 2 and can't be previewed here; their attributes, sizes and bytes are still shown. assetutil, on a Mac, prints the same information; xcrun --sdk iphoneos assetutil can also thin a catalog.

8LZFSE and LZVN

LZFSE is Apple's compression (the Compression framework, AppleArchive, OTA updates). A stream is a series of blocks, each with a 4-byte magic, ending with bvx$:

MagicBlock
bvx2LZFSE, with a packed header: three 64-bit words of fields, then the frequency tables in a variable-length code. Almost every block is this kind.
bvx1LZFSE, with the same fields as a plain 772-byte structure.
bvxnLZVN: the decompressed and compressed sizes, then an LZVN stream. The encoder uses it for inputs under 4 KB.
bvx-Stored: a size, then the bytes.

An LZFSE block holds up to 40,000 literal bytes and 10,000 matches, coded with finite state entropy (tANS): the literals as four interleaved streams of byte symbols, and the matches as (L, M, D) triples — copy L literals, then M bytes from D back (D 0 repeats the last distance) — each a symbol for a base value plus extra bits. Both bit streams are read backwards from the end of their payload, starting in the states the header gives. Matches may reach back into earlier blocks' output.

LZVN is a byte-oriented LZ77 code: opcodes that copy 0–3 literals and a match with a small (11-bit), medium (14-bit), large (16-bit) or the previous distance, opcodes for runs of 1–271 literals or matches, nops, and an end-of-stream opcode followed by 7 zero bytes. The decoders here follow Apple's open-source lzfse (lzfse_decode_base.c, lzfse_fse.h, lzvn_decode_base.c) and were checked against /usr/bin/compression_tool.

9What to look for

10What the tool shows, and its limits

The overview: the header, platform, deployment target, tool versions, counts by asset type, layout, compression and pixel format, how many bitmaps can be shown, and a bar of the file's BOM blocks (click a span for the block or the Hex tool). The findings. The assets grouped by name, with a search by name, file name or UTI and a filter by type; each rendition's attributes (scale, idiom, appearance, language, gamut…), a preview drawn on a canvas for decodable bitmaps, color swatches, image files shown as images, and buttons: open what the rendition holds in another tool (JSON, PDF, PNG, Hex…), save it, export decoded pixels as PNG. The embedded files. Every rendition's CSI header, flags, key, resources and data in hex. The BOM structure: variables, the trees' entries, every block.

Limits: the deep map, palette, RLE, JPEG-LZFSE, ASTC, DXTC and HEVC bitmaps aren't decoded (the textures and HEIF images can be saved); the GA16 and RGB5 formats are decoded as their names suggest but no sample was available to check them; resources 1012 and 1018–1022 and gradients are shown in hex; the theme catalogs of AppKit (system frameworks) are read but their attributes are only partly named. The file is read into memory; catalogs of hundreds of megabytes may be slow.

11The libraries

Four JavaScript modules with no user interface. lib/car/asset-catalog.js uses lib/car/bom.js, lib/compression/lzfse.js, lzvn.js, gzip.js, inflate.js and lib/filetype.js.

import { AssetCatalog } from "../lib/car/asset-catalog.js";
import { BomStore } from "../lib/car/bom.js";
import { Lzfse } from "../lib/compression/lzfse.js";
import { Lzvn } from "../lib/compression/lzvn.js";
MemberWhat it is
AssetCatalog.parse(bytes, { limit })Reads the catalog; throws when the bytes aren't a BOM with a CARHEADER. limit caps one rendition's decompressed size (256 MB). AssetCatalog.isAssetCatalog(bytes).
catalog.header · catalog.metadata{ coreUIVersion, storageVersion, storageTimestamp, renditionCount, mainVersion, version, uuid, associatedChecksum, schemaVersion, colorSpace, keySemantics } · { thinningArguments, deploymentPlatformVersion, deploymentPlatform, authoringTool } or null.
catalog.keyFormat · facets · appearances · localizations · bitmapKeys[{ id, name, coreUIName }] · [{ name, hotSpot, attributes: [{ id, name, value }], identifier }] · [{ name, id }] · [{ name, id }] · [{ identifier, name, version, flags, values }].
catalog.renditions[{ index, keyBlock, valueBlock, offset, length, key: [{ id, name, value, text }], attributes, name, identifier, version, flags, flagNames, width, height, scale, pixelFormat, pixelFormatName, colorSpaceId, colorSpace, modified, layout, layoutName, assetType, renditionName, resources: [{ tag, name, offset, length, value }], data: { offset, length, tag }, bitmap: { flags, compression, compressionName, length, chunks: [{ offset, length, rows }] }, raw: { flags, compressed, length, offset }, color: { colorSpaceId, colorSpace, components }, sizes, link: { frame, layout, key, target }, uti, problems }]. Offsets are in the file; assetType uses assetutil's words.
catalog.assets · countsThe renditions grouped by name [{ name, identifier, facet, renditions }] · { assetType, layout, compression, pixelFormat }, each name → count.
catalog.payload(rendition)The file it holds — { bytes, extension, kind, id, uti, compressed, error } — for PDF, SVG, JPEG, HEIF, data sets, HEVC bitmaps (a .heic) and ASTC/DXTC textures; null otherwise.
catalog.pixels(rendition){ width, height, rgba }, non-premultiplied RGBA for a canvas's ImageData; a packed-image reference gives its part of the atlas. Or { error } saying why not.
catalog.bitmapData(rendition)The bitmap as stored, decompressed: { bytes, bytesPerRow } or { error }.
catalog.findings · problems[{ severity, title, detail, rendition }] (high, medium, info) · what couldn't be read.
AssetCatalog.ATTRIBUTES, LAYOUTS, COMPRESSIONS, PIXEL_FORMATS, COLOR_SPACES, IDIOMS, RESOURCE_TAGS · AssetCatalog.sniff(bytes, uti)The tables of names · what some bytes are: { id, name, extension }.
BomStore.parse(bytes){ version, blockCount, index, variablesTable, blocks: [{ id, offset, length }], freeList, variables: [{ name, block }], problems }; variable(name), block(id) (a view of its bytes), blockOffset(id), isTree(id), tree(nameOrId) → { block, version, rootBlock, blockSize, pathCount, pages, entries: [{ keyBlock, valueBlock, key, value }], problems }. BomStore.isBom(bytes). Works on installer .bom files too (their Paths, HLIndex, VIndex, Size64 trees).
Lzfse.decompress(bytes, { limit })The data; throws on damage. Lzfse.parse(bytes, { limit }) → { blocks: [{ offset, length, magic, kind, rawBytes, payloadBytes, headerLength, literals, matches }], data, consumed, problems }. Lzfse.isLzfse(bytes).
Lzvn.decompress(bytes, outputLength, { partial })A raw LZVN stream; throws on damage unless partial. Lzvn.decode(source, sourceStart, sourceEnd, output, outputStart, outputEnd, previousDistance) → { sourceOffset, outputOffset, distance, endOfStream, error }, the decoder for streams inside larger buffers.
const catalog = AssetCatalog.parse(new Uint8Array(await file.arrayBuffer()));
for (const asset of catalog.assets) {
	console.log(asset.name, asset.renditions.map(rendition => rendition.assetType + " " + rendition.attributes.scale + "x"));
}
const config = catalog.renditions.find(rendition => rendition.name === "Config" && rendition.layout === 1000);
const json = JSON.parse(new TextDecoder().decode(catalog.payload(config).bytes));
const icon = catalog.renditions.find(rendition => rendition.assetType === "Icon Image");
const pixels = catalog.pixels(icon);
if (!pixels.error) {
	canvas.getContext("2d").putImageData(new ImageData(pixels.rgba, pixels.width, pixels.height), 0, 0);
}