How can I draw a circle in an image inside the image editor?
Try this (I'm on Blender 2.81a):

import bpy
import math

size = 640, 480

# Calculate distance between two point
def distance(p0, p1):
    return math.sqrt((p0[0] - p1[0])**2 + (p0[1] - p1[1])**2)

# blank image
image = bpy.data.images.new("circle_img", width=size[0], height=size[1])

pixels = [None] * size[0] * size[1]
center = (int(size[0]/2.0), int(size[1]/2.0)) # center of image
radius = 50 # radius of circle in pixels
for x in range(size[0]):
    for y in range(size[1]):
        d = distance((x,y),center)
        if d &lt; radius:
            r = g = b = a = 1.0 # white
        else:
            r = g = b = 0.0 # black
            a = 1.0            
        pixels[(y * size[0]) + x] = [r, g, b, a]

# flatten list
pixels = [chan for px in pixels for chan in px]

# assign pixels
image.pixels = pixels

# write image
image.filepath_raw = "/tmp/temp.png"
image.file_format = 'PNG'
image.save()


Circle isn't very pretty though (could use some anti-alias or blur)!