我想用python_fu編寫一個gimp插件。我希望它採用大量相同大小的圖層並將它們放在垂直線上。這將用於打開每個頁面佔據一個圖層的pdf文件,並且該插件將它們排成一行。當我運行插件時,菜單中沒有任何內容出現。當我用上面的星號註釋掉該行時,插件會加載到菜單中。Python_fu插件將不會載入瘸子
%USERPROFILE%\。GIMP - 2.8 \插件\ Array.py
from gimpfu import *
def plugin_main(timg, tdrawable, widthNum, heightNum):
layers = gimp-image-get-layers(timg) #<< Gets a list of all the layers
#Sets the WIDTH and HEIGHT to the size of the first image
WIDTH = layers[0].width
HEIGHT = layers[0].height
#Loops through all layers and moves them
for i in range(layers.length):
location = float((i+1)*HEIGHT)
#*****
transformedimage = gimp-item-transform-2d(layers[i], 0.0, 0.0, 1.0, 1.0, 0.0, location) #<< When I comment this line out the plugin loads
gimp-image-resize-to-layers() #<< Resizes the image to fit the moved layers
register(
"python_fu_array",
"Sets out your layers as tiles",
"Sets out your layers as tiles",
"author",
"author",
"2016",
"<Image>/Image/Array",
"RGB*, GRAY*",
[],
[],
plugin_main)
main()
UST是完全清楚的:'gimp- Python中的item-transform-2d'將意味着一系列的減法 - 而不是變量名稱。 Python中的GIMP API名稱替換爲'_'的'-'。並且它們在'pdb'命名空間中 - 所以 - 改變你的問題行來包含'pdb.gimp_item_transform-2d(...)'而不是當前的表單。 – jsbueno