Rajeev
Rajeev

Reputation: 5002

Analysing Assets.car file in iOS

I have trying to reduce the overall size of my iOS application which is currently 48MB. When I analyze sub folders, I found Assets.car is taking 41MB. I am not able to open and see which one is taking that much space.

I couldn't find any good documentation regarding Assets.car file. Can someone suggest how to view the contents?

Upvotes: 112

Views: 91661

Answers (7)

yoAlex5
yoAlex5

Reputation: 34265

Open Assets.car

[Assets.car file]

You can try an online tool(Assets.car Asset Extractor Online), or a QLCARFiles QuickLook plugin for Mac

and to double check it use assetutil tool

xcrun --sdk iphoneos assetutil --info <path_to_Assets.car>

Upvotes: 7

ibash
ibash

Reputation: 1517

All the prior mentioned tools do not extract PDFs correctly. Within the QLCARFiles project there's a utility called carDump that does extract files correctly.

In short:

  1. Clone the project from https://github.com/Timac/QLCARFiles
  2. Open in xcode
  3. Select the carDump scheme and build
  4. Use the cli:
mkdir output
carDump Assets.car output

Upvotes: 2

J.Caspar
J.Caspar

Reputation: 21

Guilherme Rambo said is correct, not the Lewis42.

Suppose a pdf file('a.pdf') in Asserts.car.

You will get three png files(a.png/[email protected]/[email protected]) if using cartool, file format had been changed.

But, if you using AssetCatalogTinkerer, you can preview the a.pdf file(no file format changed).

Upvotes: 1

Jano
Jano

Reputation: 63667

Run Apple’s assetutil:

xcrun --sdk iphoneos assetutil --info Assets.car

you’ll get a JSON description of each item in the file. Something like this:

  {
    "Height" : 60,
    "Scale" : 1,
    "RenditionName" : "D3801CE9-19F1-4CE9-97C6-7E1EFFFCAE89",
    "AssetType" : "Vector",
    "SizeOnDisk" : 10822,
    "Name" : "mailbox",
    "Idiom" : "universal",
    "Width" : 99
  },

Note the line "SizeOnDisk" : 10822.

This tool performs limited .car manipulation, run man assetutil for details.


The Assets.car seems to be a proprietary Apple’s archive that first appeared in iOS 7. A few utilities are able to extract its contents using the private class CUICatalog of the CoreUI framework:

There is also an app that reads .car files: crunch 9$, 15 day trial

Running strings Assets.car returned

@(#)PROGRAM:CoreUI  PROJECT:CoreUI-475.1.1
IBCocoaTouchImageCatalogTool-9.0

Running find inside Xcode-beta returned /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Overlays/IBCocoaTouchImageCatalogTool, which is a simulator executable (i386 + x86_64). Didn’t investigate any further but I bet that this tool could open .car archives if you run it inside the simulator.

Upvotes: 132

RhodanV5500
RhodanV5500

Reputation: 1107

Universal-binaries seem to contain multiple image resolutions for each screen-density.

Once the app is uploaded to the App Store the file-size will be less than your universal-binary, because each device will only get appropriate image densities.

You can check file-sizes here: iTunes Connect > My Apps > Your App > Activity > Your Build > App Store file-size

Upvotes: 0

Guilherme Rambo
Guilherme Rambo

Reputation: 2046

If you want to browse and extract asset catalogs, you can also use my app Asset Catalog Tinkerer

Asset Catalog Tinkerer screenshot

Upvotes: 91

lewis
lewis

Reputation: 3182

This tool can extract a .car archive: https://github.com/steventroughtonsmith/cartool

Steps to extract archive:

Once you've downloaded the zip from github, compile it in Xcode to generate the command line tool. Then expand the Products group and right click on the cartool file and locate it in finder. You can then run the tool like so:

  • open terminal
  • cd /path/to/cartool
  • ./cartool /path/to/Assets.car /path/to/outputDirectory

Upvotes: 110

Related Questions