Git Product home page Git Product logo

ios-asset-extractor's Introduction

iOS Asset Extractor

iOS Asset Extractor is a tool to extract images from the iOS SDK. It extracts PNGs, PDFs, and CAR files. I made this tool as I base the icons and images I use in my apps off of the images in Apple's stock apps. And it is much easier to have the original files, than it is to take screenshots.

Features:

  • Exports PDF, PNG, and CAR resources.
  • Exports image and PDF assets from CAR files.
  • Takes a single file, or a directory for searching as input.
  • Exports the files to a single directory, or group by the bundle they came from.

Usage:

Note: The iOSAssetExtractor executable must be next to the CARExtractor executable in order for the program to work.

$ iOSAssetExtractor -i "inputFileOrFolder" -o "outputDirectory" -g 1 -t PDF,CAR,PNG

The "i" flag is for the input file or directory to export from. If a single file, just that file is exported. If a directory is given, the directory is searched for files to export.

The "o" flag is for the directory that you want the images exported to.

The "g" flag is optional. Set it if you want the output to be grouped by bundle. The flag needs to have a 1 behind it to be set, I wasn't sure how to know the flag was set by "-g". There is a surprising lack of information on building command line tools that take flags... or command line tools in general.

The "t" flag is optional. Set it to only export specific file types. The types should be listed a a comma separated string. The types currently supported are "PDF", "CAR", and "PNG".

Examples:

Export iOS Simulator SDK:

./iOSAssetExtractor -i /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk -o /Users/bmcquilkin/Desktop/ExportIOS -g 1

Export TVOS Simulator SDK:

./iOSAssetExtractor -i /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk -o /Users/bmcquilkin/Desktop/ExportTV -g 1

Export WatchOS Simulator SDK:

./iOSAssetExtractor -i /Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk -o /Users/bmcquilkin/Desktop/ExportWatch -g 1

Export OSX SDK:

./iOSAssetExtractor -i /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -o /Users/bmcquilkin/Desktop/ExportOSX -g 1

Project Notes:

  • The car extractor needed to be placed in a separate executable. CoreUI seems to check if the current process has already loaded an "Assets.car" file, and if it has it throws a EXC_BAD_ACCESS exception. The way I found to get around it is to spawn a new extraction process for each car file we need to export. And to do that, I needed to create a separate exceutable that only extracted a single car file, and run the car extractor through NSTask as a separate process.

    There is probably a way to completely remove the evidence that a given process already loaded a car file, but this seems like an easier solution.

Contact Me:

If you have any questions comments or suggestions, send me a message. If you find a bug, or want to submit a pull request, let me know.

License:

MIT License

Copyright (c) 2016 Brandon McQuilkin

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ios-asset-extractor's People

Contributors

marxon13 avatar nikita-zhuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ios-asset-extractor's Issues

Support for Assets generated by Xcode 8?

Hi,

when Assets.car is generated by Xcode 7 CARExtractor works fine.
When Assets.car is generated by Xcode 8 (beta 3) I get an error:

Assertion failed: (tokenCount < maxCountIncludingZeroTerminator - 1), function CUIRenditionKeySetValueForAttribute, file /BuildRoot/Library/Caches/com.apple.xbs/Sources/CoreUI/CoreUI-366.1/CoreTheme/ThemeStorage/CUIThemeRendition_Support.m, line 228.
Abort trap: 6

Extraction does not work

When trying to extract a .sdk i get the following:
2018-04-16 11:44:55.804 iOSAssetExtractor[1357:76451] Searching for files...
2018-04-16 11:44:56.215 iOSAssetExtractor[1357:76451] Finished searching for files...

and nothing happens. I'm running the latest macOS High Sierra 10.13.4. Any ideas?

How exactly do I use this?

I read the Readme, but unfortunately I couldn't find out how to use this. I would love to have a foolproof method. After I download the repo's contents, what exactly should I do? Thanks :)

'NSInvalidArgumentException', reason: 'launch path not accessible'

Can anyone shed light on why I might be getting this error?

Iโ€™m running in Xcode using the following arguments:

-i /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk -o /Users/Bryan/Desktop/Exports -g 1

And getting this error:

2016-08-09 22:19:37.547 iOSAssetExtractor[77298:16874267] Searching for files...
2016-08-09 22:19:38.624 iOSAssetExtractor[77298:16874267] Finished searching for files...
2016-08-09 22:19:38.624 iOSAssetExtractor[77298:16874267] Processing file: 2/5161, /Applications/AACredentialRecoveryDialog.app/[email protected]
2016-08-09 22:19:38.624 iOSAssetExtractor[77298:16874267]     Moving file: [email protected]
2016-08-09 22:19:38.627 iOSAssetExtractor[77298:16874267] Processing file: 3/5161, /Applications/AACredentialRecoveryDialog.app/Default-Landscape@2x~ipad.png
2016-08-09 22:19:38.627 iOSAssetExtractor[77298:16874267]     Moving file: AACredentialRecoveryDialog.appDefault-Landscape@2x~ipad.png
2016-08-09 22:19:38.629 iOSAssetExtractor[77298:16874267] Processing file: 4/5161, /Applications/AACredentialRecoveryDialog.app/Default-Landscape~ipad.png
2016-08-09 22:19:38.629 iOSAssetExtractor[77298:16874267]     Moving file: AACredentialRecoveryDialog.appDefault-Landscape~ipad.png
2016-08-09 22:19:38.630 iOSAssetExtractor[77298:16874267] Processing file: 5/5161, /Applications/AACredentialRecoveryDialog.app/Default-Portrait@2x~ipad.png
2016-08-09 22:19:38.630 iOSAssetExtractor[77298:16874267]     Moving file: AACredentialRecoveryDialog.appDefault-Portrait@2x~ipad.png
2016-08-09 22:19:38.631 iOSAssetExtractor[77298:16874267] Processing file: 6/5161, /Applications/AACredentialRecoveryDialog.app/Default-Portrait~ipad.png
2016-08-09 22:19:38.632 iOSAssetExtractor[77298:16874267]     Moving file: AACredentialRecoveryDialog.appDefault-Portrait~ipad.png
2016-08-09 22:19:38.633 iOSAssetExtractor[77298:16874267] Processing file: 7/5161, /Applications/AACredentialRecoveryDialog.app/Default.png
2016-08-09 22:19:38.633 iOSAssetExtractor[77298:16874267]     Moving file: AACredentialRecoveryDialog.appDefault.png
2016-08-09 22:19:38.634 iOSAssetExtractor[77298:16874267] Processing file: 8/5161, /Applications/AACredentialRecoveryDialog.app/[email protected]
2016-08-09 22:19:38.634 iOSAssetExtractor[77298:16874267]     Moving file: [email protected]
2016-08-09 22:19:38.635 iOSAssetExtractor[77298:16874267] Processing file: 9/5161, /Applications/AccountAuthenticationDialog.app/[email protected]
2016-08-09 22:19:38.635 iOSAssetExtractor[77298:16874267]     Moving file: [email protected]
2016-08-09 22:19:38.637 iOSAssetExtractor[77298:16874267] Processing file: 10/5161, /Applications/AdSheet.app/closebox@3x~iphone.png
2016-08-09 22:19:38.637 iOSAssetExtractor[77298:16874267]     Moving file: AdSheet.appclosebox@3x~iphone.png
2016-08-09 22:19:38.639 iOSAssetExtractor[77298:16874267] Processing file: 11/5161, /Applications/AdSheet.app/closebox_inactive@3x~iphone.png
2016-08-09 22:19:38.639 iOSAssetExtractor[77298:16874267]     Moving file: AdSheet.appclosebox_inactive@3x~iphone.png
2016-08-09 22:19:38.640 iOSAssetExtractor[77298:16874267] Processing file: 12/5161, /Applications/AdSheet.app/iAd.png
2016-08-09 22:19:38.640 iOSAssetExtractor[77298:16874267]     Moving file: AdSheet.appiAd.png
2016-08-09 22:19:38.641 iOSAssetExtractor[77298:16874267] Processing file: 13/5161, /Applications/AdSheet.app/[email protected]
2016-08-09 22:19:38.641 iOSAssetExtractor[77298:16874267]     Moving file: [email protected]
2016-08-09 22:19:38.642 iOSAssetExtractor[77298:16874267] Processing file: 14/5161, /Applications/AdSheet.app/iad_corner@3x~iphone.png
2016-08-09 22:19:38.643 iOSAssetExtractor[77298:16874267]     Moving file: AdSheet.appiad_corner@3x~iphone.png
2016-08-09 22:19:38.644 iOSAssetExtractor[77298:16874267] Processing file: 15/5161, /Applications/AdSheet.app/iad_frame@2x~ipad.png
2016-08-09 22:19:38.644 iOSAssetExtractor[77298:16874267]     Moving file: AdSheet.appiad_frame@2x~ipad.png
2016-08-09 22:19:38.646 iOSAssetExtractor[77298:16874267] Processing file: 16/5161, /Applications/AdSheet.app/iad_frame@2x~iphone.png
2016-08-09 22:19:38.646 iOSAssetExtractor[77298:16874267]     Moving file: AdSheet.appiad_frame@2x~iphone.png
2016-08-09 22:19:38.647 iOSAssetExtractor[77298:16874267] Processing file: 17/5161, /Applications/AdSheet.app/iad_frame@3x~iphone.png
2016-08-09 22:19:38.648 iOSAssetExtractor[77298:16874267]     Moving file: AdSheet.appiad_frame@3x~iphone.png
2016-08-09 22:19:38.649 iOSAssetExtractor[77298:16874267] Processing file: 18/5161, /Applications/AdSheet.app/iad_frame_landscape.png
2016-08-09 22:19:38.649 iOSAssetExtractor[77298:16874267]     Moving file: AdSheet.appiad_frame_landscape.png
2016-08-09 22:19:38.650 iOSAssetExtractor[77298:16874267] Processing file: 19/5161, /Applications/AdSheet.app/[email protected]
2016-08-09 22:19:38.650 iOSAssetExtractor[77298:16874267]     Moving file: [email protected]
2016-08-09 22:19:38.651 iOSAssetExtractor[77298:16874267] Processing file: 20/5161, /Applications/AdSheet.app/[email protected]
2016-08-09 22:19:38.651 iOSAssetExtractor[77298:16874267]     Moving file: [email protected]
2016-08-09 22:19:38.653 iOSAssetExtractor[77298:16874267] Processing file: 21/5161, /Applications/AdSheet.app/iad_frame~ipad.png
2016-08-09 22:19:38.653 iOSAssetExtractor[77298:16874267]     Moving file: AdSheet.appiad_frame~ipad.png
2016-08-09 22:19:38.655 iOSAssetExtractor[77298:16874267] Processing file: 22/5161, /Applications/AdSheet.app/iad_frame~iphone.png
2016-08-09 22:19:38.656 iOSAssetExtractor[77298:16874267]     Moving file: AdSheet.appiad_frame~iphone.png
2016-08-09 22:19:38.657 iOSAssetExtractor[77298:16874267] Processing file: 23/5161, /Applications/AdSheet.app/[email protected]
2016-08-09 22:19:38.657 iOSAssetExtractor[77298:16874267]     Moving file: [email protected]
2016-08-09 22:19:38.658 iOSAssetExtractor[77298:16874267] Processing file: 24/5161, /Applications/AdSheet.app/LockGreen@2x~ipad.png
2016-08-09 22:19:38.658 iOSAssetExtractor[77298:16874267]     Moving file: AdSheet.appLockGreen@2x~ipad.png
2016-08-09 22:19:38.659 iOSAssetExtractor[77298:16874267] Processing file: 25/5161, /Applications/AdSheet.app/LockGreen@2x~iphone.png
2016-08-09 22:19:38.659 iOSAssetExtractor[77298:16874267]     Moving file: AdSheet.appLockGreen@2x~iphone.png
2016-08-09 22:19:38.660 iOSAssetExtractor[77298:16874267] Processing file: 26/5161, /Applications/AdSheet.app/LockGreen@3x~iphone.png
2016-08-09 22:19:38.660 iOSAssetExtractor[77298:16874267]     Moving file: AdSheet.appLockGreen@3x~iphone.png
2016-08-09 22:19:38.661 iOSAssetExtractor[77298:16874267] Processing file: 27/5161, /Applications/AdSheet.app/LockGreen~ipad.png
2016-08-09 22:19:38.661 iOSAssetExtractor[77298:16874267]     Moving file: AdSheet.appLockGreen~ipad.png
2016-08-09 22:19:38.662 iOSAssetExtractor[77298:16874267] Processing file: 28/5161, /Applications/AdSheet.app/LockGreen~iphone.png
2016-08-09 22:19:38.662 iOSAssetExtractor[77298:16874267]     Moving file: AdSheet.appLockGreen~iphone.png
2016-08-09 22:19:38.663 iOSAssetExtractor[77298:16874267] Processing file: 29/5161, /Applications/Camera.app/[email protected]
2016-08-09 22:19:38.663 iOSAssetExtractor[77298:16874267]     Moving file: [email protected]
2016-08-09 22:19:38.665 iOSAssetExtractor[77298:16874267] Processing file: 30/5161, /Applications/Camera.app/AppIcon29x29@2x~ipad.png
2016-08-09 22:19:38.665 iOSAssetExtractor[77298:16874267]     Moving file: Camera.appAppIcon29x29@2x~ipad.png
2016-08-09 22:19:38.667 iOSAssetExtractor[77298:16874267] Processing file: 31/5161, /Applications/Camera.app/AppIcon29x29~ipad.png
2016-08-09 22:19:38.668 iOSAssetExtractor[77298:16874267]     Moving file: Camera.appAppIcon29x29~ipad.png
2016-08-09 22:19:38.669 iOSAssetExtractor[77298:16874267] Processing file: 32/5161, /Applications/Camera.app/[email protected]
2016-08-09 22:19:38.669 iOSAssetExtractor[77298:16874267]     Moving file: [email protected]
2016-08-09 22:19:38.671 iOSAssetExtractor[77298:16874267] Processing file: 33/5161, /Applications/Camera.app/AppIcon40x40@2x~ipad.png
2016-08-09 22:19:38.671 iOSAssetExtractor[77298:16874267]     Moving file: Camera.appAppIcon40x40@2x~ipad.png
2016-08-09 22:19:38.672 iOSAssetExtractor[77298:16874267] Processing file: 34/5161, /Applications/Camera.app/AppIcon40x40~ipad.png
2016-08-09 22:19:38.673 iOSAssetExtractor[77298:16874267]     Moving file: Camera.appAppIcon40x40~ipad.png
2016-08-09 22:19:38.674 iOSAssetExtractor[77298:16874267] Processing file: 35/5161, /Applications/Camera.app/[email protected]
2016-08-09 22:19:38.674 iOSAssetExtractor[77298:16874267]     Moving file: [email protected]
2016-08-09 22:19:38.675 iOSAssetExtractor[77298:16874267] Processing file: 36/5161, /Applications/Camera.app/[email protected]
2016-08-09 22:19:38.676 iOSAssetExtractor[77298:16874267]     Moving file: [email protected]
2016-08-09 22:19:38.677 iOSAssetExtractor[77298:16874267] Processing file: 37/5161, /Applications/Camera.app/AppIcon76x76@2x~ipad.png
2016-08-09 22:19:38.677 iOSAssetExtractor[77298:16874267]     Moving file: Camera.appAppIcon76x76@2x~ipad.png
2016-08-09 22:19:38.680 iOSAssetExtractor[77298:16874267] Processing file: 38/5161, /Applications/Camera.app/AppIcon76x76~ipad.png
2016-08-09 22:19:38.680 iOSAssetExtractor[77298:16874267]     Moving file: Camera.appAppIcon76x76~ipad.png
2016-08-09 22:19:38.681 iOSAssetExtractor[77298:16874267] Processing file: 39/5161, /Applications/Camera.app/AppIcon83.5x83.5@2x~ipad.png
2016-08-09 22:19:38.681 iOSAssetExtractor[77298:16874267]     Moving file: Camera.appAppIcon83.5x83.5@2x~ipad.png
2016-08-09 22:19:38.682 iOSAssetExtractor[77298:16874267] Processing file: 40/5161, /Applications/Camera.app/Assets.car
2016-08-09 22:19:38.684 iOSAssetExtractor[77298:16874267] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'launch path not accessible'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff943334f2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff92375f7e objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff9439a4bd +[NSException raise:format:] + 205
    3   Foundation                          0x00007fff8c83c07b -[NSConcreteTask launchWithDictionary:] + 476
    4   iOSAssetExtractor                   0x0000000100002ff3 export + 4099
    5   iOSAssetExtractor                   0x0000000100003efb main + 1723
    6   libdyld.dylib                       0x00007fff8d7445ad start + 1
    7   ???                                 0x0000000000000008 0x0 + 8
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

not really an issue

just wondered if you could update this for iOS 9.0.2 iPhone 6s+

thanks

Dan

Getting problems with .car file

I need to extract .car file. but in terminal i am getting errors. can you provide exact steps for extracting .CAR file ?

Initially it is showing permission denied error. then when i give permission by sudo chmod 755 command, it is showing cannot execute binary file error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.