python-fu select copy paste

孤街浪徒 提交于 2019-12-06 13:31:54

The PDB calls to do that are better in this order:

# import your image:
img=pdb.gimp_file_load('/path/'+fn,fn)

#make the selection
pdb.gimp_rect_select(img,10,200,1422,1024,2,0,0)


# copy
pdb.gimp_edit_copy(img.layers[0])
# (no need to "get_active_layer" - if
# your image is a flat PNG or JPG, it only has one layer,
# which is accessible as img.layers[0]) 

# create a new image from the copied area:
new_img = pdb.gimp_paste_as_new()

#rotate the newly created image:
pdb.gimp_image_rotate(new_img, ...)

#export the resulting image:
pdb.gimp_file_save(new_img, ...)

#delete the loaded image and the created image:
# (as the objects being destroyed on the Python side
# do not erase then from the GIMP app, where they
# stay consuming memory)
pdb.gimp_image_delete(new_img)
pdb.gimp_image_delete(img)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!