5

Thanks for your comments. I realize my initial wording might have been confusing, so I have attempted to clarify what I'm looking for...


I use Inkscape for designing and exporting app assets. These assets are created a 4x scale (which corresponds to xxxhdpi on Android or @4xon iOS). Let's assume I have several vector icons that are 256x256 pixels within a single SVG opened in Inkscape. I need to export each of these icons at the following resolutions:

  • 22.50 dpi (mdpi for Android) -> 64x64 pixels
  • 33.75 dpi (hdpi for Android) -> 96x96 pixels
  • 45.00 dpi (xhdpi for Android, @2x for iOS) -> 128x128pixels
  • 67.50 dpi (xxhdpi for Android, @3x for iOS) -> 192x192 pixels

Doing this manually is really tedious. My question is thus: Is there an efficient way to export one or several specific objects within an SVG file at multiple resolutions from within Inkscape?

Note: I have hacked together a working, scripted solution that invokes svg-objects-export multiple times, but it is very slow and inconvenient, because I need to adapt the script every time I add an asset to the SVG file.

Ideally, I'm looking for a solution from within Inkscape ("Click and export", possibly for multiple selected objects at once). If that's not possible I'll take the next best option. A command line solution would be fine, as long as it's fast and automatically exports all assets in a file.

For quality reasons, I am also not looking for a solution to scale down exported PNGs.

9
  • Have you got a look to Export Command Line Options? The --export-dpi flag can help. Jun 8, 2016 at 7:48
  • @PaoloGibellini Good hint, thank you. The Python script that I mentioned above is using this option as well. It seems that I would to have to specify each object manually with --export-id, though. I was hoping to find a solution that would just allow me to export all objects in the SVG. Such an option does not seem to exist, though. Jun 8, 2016 at 8:44
  • Mmm... perhaps a simple batch file or shell file could be enough. Jun 8, 2016 at 10:36
  • 1
    @Scribblemacher Thanks. I realize I didn't properly state that I'm looking for a solution to export (multiple) individual objects from within one SVG file. I have updated the question accordingly... Aug 26, 2016 at 19:49
  • 1
    Ah, now I understand. Using --export-id as @KlaasNotFound mentioned seems like a perfectly fine solution to me if you give areas a predictable name. Personally I would just split it up into separate SVG files, and have a script run through each file in a directory. While this is probably a common use-case for Inkscape, it simply doesn't have the capability to do what you are asking (as is--I'm sure an extension could be written). I'd be curious if Illustrator has this feature. Aug 29, 2016 at 11:42

4 Answers 4

2

Create clones of your icons for each of the addition sizes you want to export. Give them ID:s in Object Properties and use the batch export option to save all of them in one click.

inkscape clones

0

Maybe try any of these extensions (didn't test them):

https://inkscape.org/en/~owenfromcanada/%E2%98%85androidvector (different concept, exports vectors for Android)

https://github.com/ChristianBecker/inkscape-android-export (what you've been asking for)

(a web search may find a couple more of those, key words 'extension Inkscape android')

0

There is an App Icon Generator Extension by Carlos Vazquez, but looks like the author abandoned the project and do not accepts pull requests. The best fork so far: https://github.com/firephreek/inkscape_app_icon_generator

-1

Check out this tool https://github.com/redwarp/9-patch-resizer It will automatically resize .png files into several densities.

1
  • "For quality reasons, I am also not looking for a solution to scale down exported PNGs." Dec 25, 2016 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.