Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Bitmap anlegen welches doppelt so groß ist wie das Originalbild
- Bitmap outputimage = new Bitmap(inputimage.Width * 2, inputimage.Height * 2);
- // Erste for-Schleife durchläuft das Bild horizontal
- for (int x = 0; x < inputimage.Width; x++)
- {
- // Zweite for-Schleife durchläuft das Bild Vertikal
- for (int y = 0; y < inputimage.Height; y++)
- {
- // Farbwerte des Originalbildes holen
- Color pixelRGB = inputimage.GetPixel(x, y);
- // Vergrößern der Pixel und Zusammensetzen des skalierten Bildes
- outputimage.SetPixel(x * 2 + 1, y * 2, pixelRGB);
- outputimage.SetPixel(x * 2 + 1, y * 2 + 1, pixelRGB);
- outputimage.SetPixel(x * 2, y * 2, pixelRGB);
- outputimage.SetPixel(x * 2, y * 2 + 1, pixelRGB);
- }
- }
- return outputimage;
Add Comment
Please, Sign In to add comment