python - NameError global name 'ImageDraw' is not defined -
I am new, hello therefore community I wandered with pillow I am using this type of attribute in my attribute (Tkinter, BmpImagePlugin, cStringIO, subprocess, ctype s, re .. n) Code> PIL shows import * I try-leaving My original code portion my error, But I have installed the pillow module and I am importing empty in PIL or Image..N Creating a Python file module is working only on my_project (o.py) Is not than you interest. good works. You have called us the "Tanker" module if you are importing the Tanker module Typically, use this as a programmer and use the PIL module, we should know about the names of each module class Because its conflicts Tuning in the image module, both the PIL in the image module. The open feature is almost the same. I suggest, use this kind of PIL import image, image draw, image font from
resolve this code line with the effort: Excluding AITITI from PIL import : No Import Mind # ImageN Import Image Import mageDraw Import ImageFactory
class capsGen (object): def __init __ (self): pass def videoGen (auto, path): Iv = input video stream () iv.open (path) self.videoHead (path) print itself .topDuration frameDiff = list (count (iv.readframe ())) #bmp - & gt; [Io] [1] self.totalFrame = frameDiff [-1] [0] # 16 IMGS itself GIIG = [] curImg = 0 while true: if curImg & lt; 16: self.genImgs.append (RANDIN (1, self.totalFrame)) curImg = curmeg + 1 else: try break: src = PIL.image.open ("src.png") ciz = PIL.ImageDraw.draw (Src) Ft = PIL.ImageFont.truetype ("arial.ttf", 32) ciz.text ((190,15), self.fileName, font = ft) #fileName src.save ("1.png") # Print frameDiff [5] [0] I for myself JNIG: IMJ = PIL.Image.Open (Stringio Stringio (framediff [I] [1]) # 20 Io - & gt; Except imj.save ("% s.png"% i), nameError: src = Image.open ("src.png") ciz = ImageDraw.draw (src) ft = ImageFont.truetype (" Ariel .tft ", 32) ciz.text ((190,15), self.fileName, font = ft) #fileName src.save (" 1.png ") #print frameDiff [5] [0] for myself GenImgs: imj = Image.open (string IO.StringIO (framediff [i] [1]) # base - & gt; [Iio] [1] imj.save ("% s.png"% i)
traceback (the most recent call) Last): The file "o.py", in line 275, (module) run = capsGen () file "o.py", line 42, __init__ self.videoGen () # The file "o.py" for the developers, line 157, videoGen ciz = ImageDraw.draw (src) NameError: The global name 'ImageDraw' is not defined
and in the end, you can reference the name of the string For example, for example,
class tryAgain (object): def __init __ (self): self.referenceName = "Hell" + "o" def run (self): img = Image .open (self.referenceName) like #ths such as
Comments
Post a Comment