如何将png图像转换为矢量化图像?

时间:2017-09-06 20:42:12

标签: android image svg vector

我使用这个在线转换器而不仅仅是这个 https://image.online-convert.com/convert-to-svg将图像转换为矢量,但我只能将图像作为svg图标,其标记为svg,但我需要使其标记矢量像这种格式

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24.0"
    android:viewportHeight="24.0">
<path
    android:fillColor="@color/redtext"
    android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/>

所以我怎样才能获得这种格式的图像并使其成为矢量图像。我也尝试使用插图画家,但我也只获得svg。我需要Android应用程序的图像。

1 个答案:

答案 0 :(得分:2)

右键单击图像文件夹(如drawable或mipmap)&gt; New&gt; Vector Asset

enter image description here

选择.svg文件并设置名称:

enter image description here

您将创建矢量可绘制文件:

enter image description here

<vector android:height="24dp" android:viewportHeight="24.0"
    android:viewportWidth="24.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
    <path android:fillColor="#FFFFFF" android:pathData="M21.71,11.29l-9,-9c-0.39,-0.39 -1.02,-0.39 -1.41,0l-9,9c-0.39,0.39 -0.39,1.02 0,1.41l9,9c0.39,0.39 1.02,0.39 1.41,0l9,-9c0.39,-0.38 0.39,-1.01 0,-1.41zM14,14.5V12h-4v3H8v-4c0,-0.55 0.45,-1 1,-1h5V7.5l3.5,3.5 -3.5,3.5z"/>
</vector>
相关问题