2

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.

  • Have you got a look to Export Command Line Options? The --export-dpi flag can help. – Paolo Gibellini Jun 8 '16 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. – KlaasNotFound Jun 8 '16 at 8:44
  • Mmm... perhaps a simple batch file or shell file could be enough. – Paolo Gibellini Jun 8 '16 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... – KlaasNotFound Aug 26 '16 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. – Scribblemacher Aug 29 '16 at 11:42
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')

-1

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

  • "For quality reasons, I am also not looking for a solution to scale down exported PNGs." – Ilmari Karonen Dec 25 '16 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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