Designers work with all sorts of programs, and most of them don't run on Linux.
Adobe Illustrator is one of those programs.
If you're a developer on Linux and a designer hands you a .ai file to work with, it's going to make your life difficult.
Here are some tricks I've learned to get what you need out of the illustrator file:
Adobe Illustrator .ai files are just PDFs
This is great, because it allows us to use various PDF tools to extract the information we need.
We're going to make use of poppler, a PDF library, to extract some of the information we need.
Extracting images from an Adobe Illustrator .ai file on Linux
From poppler, we get the pdfimages
command, which will dump all of the images inside of a .ai file.
Here's the command:
pdfimages my_file.pdf /output/directory/image-file-prefix
Images will be exported as /output/directory/image-file-prefix-000.ppm
, /output/directory/image-file-prefix-001.ppm
, etc.
From there, you can open the images and convert them as needed.
Extracting fonts from an Adobe Illustrator .ai file on Linux
Poppler also gives us pdffonts
to list the fonts in a .ai file.
pdffonts my_file.pdf
Extracting vector art from a .ai file on Linux
Unfortunately, I don't have a great solution for this. It seems that there are tools to export your .ai file to a giant .svg, but there would be many layers within that SVG.
Since the vector you want to export can be complex, and might include multiple layers itself, the user would have to interact at this point in order to choose which layers make up the object we want to export.
Inkscape is one solution, but it is very slow for large .ai files and exporting objects is tedious.
GIMP may be able to do this, but I've not yet discovered the way. For the moment, I'm just screenshotting the vectors and luckily I haven't needed any transparent backgrounds so far.
If you have tips here, please comment!
That's all for now. Follow me here on dev.to or on Twitter @connorbode for more on Linux, Python, VIM, etc.
Top comments (0)