How can I export a high resolution image

I have the coordinates and colors of the pixels of an image I want to create.
How can I export a high resolution image?
Any suggestion using:

System.Drawing
System.Drawing.Bitmap
System.Drawing.Image

I searched on python forums and they all point to an additional module (Pillow).

Here’s the simple native .NET method, see further down for the the more advanced lockbits method:

1 Like

Thanks AndersDeleuran

I will work on this idea

1 Like

What could be wrong?

import rhinoscriptsyntax as rs
import Rhino
import scriptcontext as sc
import time
from System.Drawing import Bitmap
import System
import System.Drawing as sd
import math
from System.Drawing import Color

bm = sd.Bitmap(resx,resy)
color = sd.Color
for x in xrange(resy*resx):
	j = x // resx
	i = x % resx
	color = cores[x][0], cores[x][1], cores[x][2]
	bm.SetPixel(i, j, color)
bm.Save("c:\\users\\public\\test.jpg", sd.Imaging.ImageFormat.Jpeg)

Message: expected Color, got tuple

Traceback:
line 110, in moveup3D2img, “C:\Users\cristiano.pasini\Downloads\moveup3D2img.py”
line 122, in , “C:\Users\cristiano.pasini\Downloads\moveup3D2img.py”

color = sd.Color.FromArgb(255, cores[x][0], cores[x][1], cores[x][2])

It Works!!!
Thanks!!!

1 Like