Generated images are not anti-aliased
Closed this issue · 4 comments
This is a great tool , but the problem is when using vector images that have curves , so generated images have sharp edges in curves and are not anti-aliased , so in these cases quality is very low!!!
Are you sure it isn't anti-aliasing? It could be your source SVGs; for example, if you have shape-rendering="crispEdges"
set, then it skips anti-aliasing.
If I could have a sample SVG then I could work with it and see if the problem is the SVG or Victor.
Thank you for replying
This is a 512x512 svg icon , I'm trying to use it as an actionbar menu item icon , but it loses the quality in small dimensions. I mean it behaves like a raster image when we try to scale it down , opposite to what we expect from a svg as a vector graphic to be able to keep its quality in any scale !
please test it by victor for setting it as an actionbar menu icon .
vect_share.zip
Also please look at this code snippet , I scale it down programmatically and set it as menu icon and everything is ok and antialiasing is applyed , but by using victor I face sharped edges . your tool is great because it can generate images for different device screens and we don't need to write it manually! , but if it can do it by keeping quality in scales .
I wrote it by using this library :
compile 'com.caverock:androidsvg:1.2.1'
please try it you will see it holds quality even by scaling images:
MenuItem item = menu.findItem(R.id.action_share);
try {
SVG svg = SVG.getFromResource(getResources(), R.raw.vect_share);
Bitmap bmp = Bitmap.createBitmap(64, 64, Bitmap.Config.ARGB_8888);
Canvas cnv = new Canvas(bmp);
cnv.drawPicture(svg.renderToPicture(), new Rect(0, 0, 64, 64));
BitmapDrawable bitmapDrawable = new BitmapDrawable(bmp);
item.setIcon(bitmapDrawable);
} catch (SVGParseException e) {
e.printStackTrace();
}
So wait - you're taking a 512x512 image, rendering it via Victor, then shrinking it down to actionbar size? Victor isn't downsizing anything in that case, it's Android that's doing it.