I am currently trying to render some .svg images to .png/.jpg images using the batik rasterizer library.
If I try to convert an image within its aspect ratio, everything works fine, but when I try to change the aspect ratio(let's say the vector image is quadratic, e.g. 32x32 and I want to stretch it to 64x32), it gives me an output Image that has a size of of 64x32 pixels with the vector being drawn in the middle of the image as a 32x32 area. THis is the code I'm using:
PNGTranscoder transcoder = new PNGTranscoder();
transcoder.addTranscodingHint(PNGTranscoder.KEY_WIDTH, width); //64px
transcoder.addTranscodingHint(PNGTranscoder.KEY_HEIGHT, height); //32px
Also, I would like to stretch an image until it has a width of 128 pixels, independet from its height, using the transcoding hint PNGTranscoder.KEY_MAXWIDTH
, but the ranscoder just does not scale the image up to this width.
What am I doing wrong?