Pyphon 스크립트의 김프 편집 블렌드는 블렌드 도구와 다른 조화를 이룹니다.

StackOverflow https://stackoverflow.com//questions/23058643

  •  26-12-2019
  •  | 
  •  

문제

저는 Ubuntu 13.10에서 김프 2.8을 사용하여 두 개의 이미지를 다시 크기로 재 조정하고 이동하고 혼합하는 스크립트를 작성하려고합니다.

2 개의 필요한 이미지와 결과를 업로드했습니다. http://imgur.com/a/bjgia

나는 모든 것을 실행할 수있게되었지만 한 점은 실패합니다.블렌딩 명령.PDB.GIMP_EDIT_BLEND 명령으로 문제를 줄이는 대신 투명한 배경으로 레이어 마스크를 혼합하는 대신 불투명 한 그라데이션을 만듭니다.

image = gimp.image_list()[0]  #image is 237x300 png like above
pdb.gimp_image_resize(image, 300, 300, -100, 0)
fg_layer = pdb.gimp_image_get_active_layer(image)
mask = pdb.gimp_layer_create_mask(fg_layer,ADD_WHITE_MASK)
pdb.gimp_image_add_layer_mask(image, fg_layer, mask)

# from here it goes wrong, if I skip this step than I can get the correct result
# using the gimp blent tool from the gui using the same settings as here
pdb.gimp_edit_blend(fg_layer, FG_BG_RGB_MODE, NORMAL_MODE, GRADIENT_LINEAR, 100, 0, 0, True, False, 0, 0, True, 0, 150, 150, 150)
.

전체 코드는 다음과 같습니다. http://pastie.org/9079343

내가 뭘 잘못하고 있는지 아이디어? 고마워요

도움이 되었습니까?

해결책

오류는 당신 자신의 코드에서 꽤 많이 있습니다 - 당신은 블렌딩 기능을 통과하는 것을 호출합니다. MASK 대신 FG_LAYER의 첫 번째 매개 변수로서 :

pdb.gimp_edit_blend(fg_layer, FG_BG_RGB_MODE, NORMAL_MODE, GRADIENT_LINEAR, 100, 0, 0, True, False, 0, 0, True, 0, 150, 150, 150)
                    ^^^^^^^^
.

대신, 마스크를 Drawable 매개 변수로 전달하는 동일한 호출을 수행하십시오 (이미 "마스크"변수에 있음) :

pdb.gimp_edit_blend(mask, FG_BG_RGB_MODE, NORMAL_MODE, GRADIENT_LINEAR, 100, 0, 0, True, False, 0, 0, True, 0, 150, 150, 150)
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top