{"id":19847089,"url":"https://github.com/polidea/basset-ios","last_synced_at":"2025-07-05T06:03:18.771Z","repository":{"id":32852994,"uuid":"36446663","full_name":"Polidea/basset-ios","owner":"Polidea","description":"Converting vector based images to iOS-style PNG(s) tool that organizes them in XCode Assets","archived":false,"fork":false,"pushed_at":"2020-09-06T04:39:14.000Z","size":13021,"stargazers_count":54,"open_issues_count":6,"forks_count":7,"subscribers_count":15,"default_branch":"master","last_synced_at":"2023-04-01T06:23:01.796Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Polidea.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-28T15:07:52.000Z","updated_at":"2023-04-01T06:23:01.796Z","dependencies_parsed_at":"2022-07-24T17:32:11.932Z","dependency_job_id":null,"html_url":"https://github.com/Polidea/basset-ios","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polidea%2Fbasset-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polidea%2Fbasset-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polidea%2Fbasset-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polidea%2Fbasset-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Polidea","download_url":"https://codeload.github.com/Polidea/basset-ios/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224278375,"owners_count":17285080,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T13:13:23.283Z","updated_at":"2024-11-12T13:13:23.835Z","avatar_url":"https://github.com/Polidea.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\" \u003e\n\u003cimg src=\"./readme_resources/basset_bg.png\" alt=\"basset\" title=\"basset\"/\u003e\n\u003c/p\u003e\n\n[![Build Status](https://travis-ci.org/Polidea/basset-ios.svg)](https://travis-ci.org/Polidea/basset-ios)\n\n**Basset** is an image converting and organizing tool, that allows developers to take care of only vector versions of assets used in iOS projects.\n\nMain features of **Basset** can be describd in two steps:\n\n1. Converting vector images (.svg, .eps, .pdf, .psd) to PNG(s) with resolutions and names properly recognized by iOS apps (@2x, @3x etc.)\n2. Copying assets from previous steps to selected .xcasset files and creating proper JSONs there.\n\n\n####Why just don't use XCode's PDF support?\n\n1. Each PDF what is drag-and-dropped to XCode is assigned to @1x category in xcassets. For each of them you need to drag them again to \"All\" category, what is really painful when you're using hundreads of images in your projects.\n2. It's easier to manage ordinary directory of assets than .xcassets. You don't have to use XCode to do that. so even non-developers can add resources to the project.\n3. Check of this link: [http://bjango.com/articles/idontusepdfs/](http://bjango.com/articles/idontusepdfs/)\n\n##Getting started\n\n###Prerequisites\n\n**Basset** requires:\n\n* OSX (tested on Yosemite)\n* Homebrew or docker installed \n\nIt should also work on other Unix-like system, but it wasn't tested there.\n\n\n###Installation\n\n####Homebrew\n\nOpen your terminal and type\n\n```\nbrew tap Polidea/tap\nbrew install basset_ios\n```\n\nIn order to upgrade **Basset** type:\n\n```\nbrew update\nbrew upgrade basset_ios\n```\n\n#### Adobe Illustrator save to .SVG options\n\nIn order to export assets form Adobe Iloustrator to SVG files that are supported by **Basset**, you need to select \"CSS Properties\" set as \"Style Attributes\".\n\nAlso keep in mind to convert all fonts in the artboards to outlines (you can also use \"Conver to outline\" option during saving).\n\n\u003cimg src=\"./readme_resources/illustrator.png\" style=\"width: 400px;\"/\u003e\n\n####Troubleshooting\n\n#### Incorrect gradients when using SVG files\n\nIn order to convert SVG's to PNG's with correct gradients we're using *librsvg* that is someting incorrectly installed by Homebrew. In order to install **Basset** with *librsvg* you need to:\n\n```\nbrew uninstall librsvg\nbrew uninstall imagemagick\nbrew uninstall basset_ios\n\nbrew install basset_ios\n```\n\n#### Outdated homebrew version\nin case you've recieved this error:\n\n```\nError: undefined method `desc' for ...\n```\n\nplease make sure you've newest version of homebrew. You can update it by running ```brew update``` command\n\n#### El Capitan XCode issue\n\nIf during installation on El Capitan you recieve\n\n```\nerror: cannot run C compiled programs\n```\n\nrun \n\n```\nxcode-select —install\n```\n\n##Usage\n\nIn order to use **Basset** you need to tell which directory you're using to store vector images, where generated PNGs will be store etc. You can do this by following naming convention written below, or by specifying explicit configuration via command line parameters or dedicated configuration file.\n\nSVG is recommended file format for **Basset**.\n\nRemember that you'll have to create .xcassets directory that you want to use **on your own**. If you'll have more than one .xcassets in your project, you'll need to specify which one you want **Basset** to operate on.\n\n### Naming convention\n\nIn order to use **Basset** you need to place:\n\n* All vector images used in the project needs to be stored in ```Resources/Assets``` directory\n* Default *xcassets* directory needs to be in ```Resources/Images.xcassets```\n* Generated PNG(s) will be stored in ```Resources/GeneratedAssets``` directory\n\n\nIf you'll follow this convention, you can can run **Basset** in root directory of your iOS project, and all vector images will be processed, and stored in proper xcassets directory.\n\nIf you'd like to use different settings, you need to provide configuration file, or override default settings in command line.\n\n\n###Config file\n\n```\n# Default xcasset dir\nxcassets_dir: Assets.xcassets\n\n# Where vector images are kept\nraw_assets: VectorAssets\n\n# Where generated PNG(s) will be kept\ngenerated_assets_dir: GeneratedAssets\n\n# Should generated PNG(s) be merged to xcassets folder\nmerge_with_xcassets: True\n\n# Should convert all assets every time\nforce_convert: False\n```\n\n#### Example\n\nYou can run **Basset** with configuration file by providing path to it as ```-c``` parameter, for example:\n\n```\nbasset-ios -c \"Assets/config.yml\"\n```\n\n###Command line\n```\nbasset-ios [-h] [-d XCASSETS_DIR] [-a RAW_ASSETS_DIR]\n                 [-g GENERATED_ASSETS_DIR] [-m MERGE_WITH_XCASSETS]\n                 [-c CONFIG] [-e EXTRACT_PATH]\n\narguments:\n  -h, --help\t\t\t\t\t\t\t\t\t\tshow help message and exit\n  -x, --xcassets_dir XCASSETS_DIR\t\t\t\t\tpath to directory with default xcassets directory\n  -r, --raw_assets_dir RAW_ASSETS_DIR\t\t\t\tpath to directory with raw, vector based graphics\n  -g, --generated_assets_dir GENERATED_ASSETS_DIR\tpath to directory where generated PNGs will be stored\n  -m, --merge_with_xcassets MERGE_WITH_XCASSETS\t\twill script process xcassets directories\n  -f, --force_convert FORCE_CONVERT\t\t\t\t\tshould regenerate assets even when they were generated before\n  -c, --config CONFIG\t\t\t\t\t\t\t\tpath to config file\n  -e, --extract_path EXTRACT_PATH\t\t\t\t\tif set to existing xcassets directory, will extract all assets from it to \"raw_assets_dir\"\n    \n  \n```                        \n\n## Extracting assets from existing .xcassets\n\nIn case you'd have existing project, with existing .xcassets with PDFs, you can extract them to separate directory, so it could be used in the future.\n\nIn order to extract vectors from existing .xcassets directory, you need to run whi command:\n\n```\nbasset_ios -e \u003cpath_to_xcassets_dir\u003e -r \u003cpath_to_vector_assets_dir\u003e\n```\n\n## Example\n\n1) First of all create new iOS project. Make sure it contains *xcassets* folder inside.\n\n\u003cimg src=\"./readme_resources/1.png\" style=\"width: 300px;\"/\u003e\n\n2) Create Assets folder, and put all your vector images in there.\n\n\u003cimg src=\"./readme_resources/2.png\" style=\"width: 200px;\"/\u003e\n\n3) Create config file:\n\n```\nxcassets_dir: test_basset/Images.xcassets\nraw_assets: Assets\ngenerated_assets_dir: GeneratedAssets\nmerge_with_xcassets: True\nforce_convert: False\n``` \n\nand save it as config.yml in project root folder:\n\n\u003cimg src=\"./readme_resources/3.png\" style=\"width: 200px;\"/\u003e\n\n4) Open terminal, change current directory to your iOS project, and type:\n\n```\nbasset_ios -c config.yml\n```\n\n5) All vector images should be converted to PNGs and put into selected ```xcassets``` folder.\n\n\u003cimg src=\"./readme_resources/5.png\" style=\"width: 600px;\"/\u003e\n\nAll images are now visible in XCode:\n\n\u003cimg src=\"./readme_resources/4.png\" style=\"width: 600px;\"/\u003e\n\n##License\nBasset-ios is released under a MIT License. See LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolidea%2Fbasset-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolidea%2Fbasset-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolidea%2Fbasset-ios/lists"}