小编Kyl*_*age的帖子

使用PIL保存图像

我正在尝试使用PIL保存我从头开始创建的图像

newImg1 = PIL.Image.new('RGB', (512,512))
pixels1 = newImg1.load()

...

for i in range (0,511):
    for j in range (0,511):
       ...
            pixels1[i, 511-j]=(0,0,0)
        ...

newImg1.PIL.save("img1.png")
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

回溯(最近一次调用最后一次):文件"",第1行,文件"C:\ Python27\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",第523行,在runfile execfile中(文件名,命名空间) )文件"C:\ Python27\Lib\site-packages\xy\pyimgmake.py",第125行,在newImg1.PIL.save("img1.png")文件"C:\ Python27\lib\site-packages\PIL\Image.py",第512行,getattr 引发AttributeError(name)AttributeError:PIL

我需要帮助解释此错误以及如何正确保存图像为"img1.png"(我将图像保存到默认保存点我很好).


更新:

from PIL import Image as pimg
...
newImg1 = pimg.new('RGB', (512,512))
...
newImg1.save("img1.png")
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

... newImg1.save("img1.png")文件"C:\ Python27\lib\site-packages\PIL\Image.py",第1439行,保存save_handler(self,fp,filename)文件"C:\Python27\lib\site-packages\PIL\PngImagePlugin.py",第572行,_save ImageFile._save(im,_idat(fp,chunk),[("zip",(0,0)+ im.size, 0,rawmode)])文件"C:\ Python27\lib\site-packages\PIL\ImageFile.py",第481行,在_save中e = Image._getencoder(im.mode,e,a,im.encoderconfig)文件"C:\ Python27\lib\site-packages\PIL\Image.py",第399行,在_getencoder中返回apply(编码器,(模式,)+ args + extra)TypeError:需要一个整数

python python-imaging-library

25
推荐指数
2
解决办法
7万
查看次数

PL/SQL Commit Issue

I have the following code:

BEGIN
DBMS_SCHEDULER.DROP_JOB (
job_name => 'MYJOB');
END;

COMMIT;
Run Code Online (Sandbox Code Playgroud)

I get the following error message:

Error report: ORA-06550: line 6, column 1: PLS-00103: Encountered the symbol "COMMIT" 06550. 00000 - "line %s, column %s:\n%s" *Cause: Usually a PL/SQL compilation error. *Action:

What is the problem with the syntax I am using for committing?

plsql oracle-sqldeveloper

1
推荐指数
1
解决办法
4817
查看次数