your source code is hard to read, as it is a combination of German and English in variable names. Also, you donโt say which image library you are using, so we donโt know exactly where the Bitmap and Color classes came from.
In any case, it is very obvious that you only work with a bitmap image. A bitmap means that the entire image is stored in pixels of RAM per pixel. No lossy compression. I donโt see anything in your source code that can affect image quality.
It is very likely that the answer is indicated in the Code, which you do not show us. In addition, what you describe (botrh problems) sounds like very typical low quality JPEG compression. I'm sure somewhere after calling the function you convert / save the image in JPEG format. Try to do this in this position in BMP, TIFF or PNG and make sure that the error has magically disappeared. Perhaps you can also set the JPEG quality level somewhere to avoid this.
To make it easier for others to (possibly) also find a good answer, let me translate your code into English:
public static Bitmap edit_image(Bitmap src,boolean makeborder) { int width = src.getWidth(); int height = src.getHeight(); int A, R, G, B; int pixel; int middlex = width/2; int middley = height/2; int sideLength,startx,starty; if(width>height) { sideLength=height; starty=0; startx = middlex - (sideLength/2); } else { sideLength=width; startx=0; starty = middley - (sideLength/2); } int circleRadius = sideLength/2; int middleX = startx + circleRadius; int middleY = starty + circleRadius; int border=2; int sideDistance=55; Bitmap bmOut = Bitmap.createBitmap(sideLength+sideDistance, sideLength+sideDistance, Bitmap.Config.ARGB_8888); bmOut.setHasAlpha(true); for(int x = 0; x < width; ++x) { for(int y = 0; y < height; ++y) { int distanceToMiddle = (int) (Math.pow(middleX-x,2) + Math.pow(middleY-y,2)); // (Xm-Xp)^2 + (Ym-Yp)^2 = dist^2 distanceToMiddle = (int) Math.sqrt(distanceToMiddle); pixel = src.getPixel(x, y); A = Color.alpha(pixel); R = (int)Color.red(pixel); G = (int)Color.green(pixel); B = (int)Color.blue(pixel); int color = Color.argb(A, R, G, B); int afterx=x-startx+(sideDistance/2); int aftery=y-starty+(sideDistance/2); if(x < startx || y < starty || afterx>=sideLength+sideDistance || aftery>=sideLength+sideDistance) //margin { continue; } else if(distanceToMiddle > circleRadius) { color=0x00FFFFFF; } else if(distanceToMiddle > circleRadius-border && makeborder) //border { color = Color.argb(A, 0, 0, 0); } bmOut.setPixel(afterx, aftery, color); } } return bmOut; }