|
9 | 9 | PROC_NAME = 'python-fu-resize-ris'
|
10 | 10 | PROC_LABEL = 'Resize RIS'
|
11 | 11 | PROC_AUTHOR = 'zvezdochiot <[email protected]>'
|
12 |
| -PROC_DATE = '2021-03-10' |
| 12 | +PROC_DATE = '2021-03-13' |
13 | 13 |
|
14 | 14 | def ris(image, drawable, width, height, interpol):
|
15 | 15 | image.undo_group_start()
|
16 | 16 | orig_width = pdb.gimp_image_width(image)
|
17 | 17 | orig_height = pdb.gimp_image_height(image)
|
18 | 18 |
|
19 |
| - copy_image = pdb.gimp_image_duplicate(image) |
20 |
| - copy_drawable = pdb.gimp_image_get_active_drawable(copy_image) |
21 |
| - blur_image = pdb.gimp_image_duplicate(image) |
22 |
| - blur_drawable = pdb.gimp_image_get_active_drawable(blur_image) |
| 19 | + image_copy = pdb.gimp_image_duplicate(image) |
| 20 | + drawable_copy = pdb.gimp_image_get_active_drawable(image_copy) |
| 21 | + image_blur = pdb.gimp_image_duplicate(image) |
| 22 | + drawable_blur = pdb.gimp_image_get_active_drawable(image_blur) |
23 | 23 |
|
24 | 24 | pdb.gimp_context_set_interpolation(interpol)
|
25 |
| - pdb.gimp_image_scale(blur_image, width, height) |
26 |
| - pdb.gimp_image_scale(blur_image, orig_width, orig_height) |
| 25 | + pdb.gimp_image_scale(image_blur, width, height) |
| 26 | + pdb.gimp_image_scale(image_blur, orig_width, orig_height) |
27 | 27 |
|
28 |
| - blur_layer = pdb.gimp_layer_new_from_visible(blur_image, image, "ResizeBlur") |
29 |
| - pdb.gimp_image_insert_layer(image, blur_layer, None, -1) |
30 |
| - pdb.gimp_image_set_active_layer(image, blur_layer) |
31 |
| - blur_layer.mode = SUBTRACT_MODE |
| 28 | + layer_blur = pdb.gimp_layer_new_from_visible(image_blur, image, "ResizeBlur") |
| 29 | + pdb.gimp_image_insert_layer(image, layer_blur, None, -1) |
| 30 | + pdb.gimp_image_set_active_layer(image, layer_blur) |
32 | 31 |
|
33 |
| - copy_layer = pdb.gimp_layer_new_from_visible(copy_image, image, "CopyOrig") |
34 |
| - pdb.gimp_image_insert_layer(image, copy_layer, None, -1) |
35 |
| - pdb.gimp_image_set_active_layer(image, copy_layer) |
36 |
| - copy_layer.mode = ADDITION_MODE |
| 32 | + layer_copy = pdb.gimp_layer_new_from_visible(image_copy, image, "CopyOrig") |
| 33 | + pdb.gimp_image_insert_layer(image, layer_copy, None, -1) |
| 34 | + pdb.gimp_image_set_active_layer(image, layer_copy) |
| 35 | + layer_copy.mode = SUBTRACT_MODE |
37 | 36 |
|
38 |
| - blur_layer2 = pdb.gimp_layer_new_from_visible(blur_image, image, "ResizeBlur2") |
39 |
| - pdb.gimp_image_insert_layer(image, blur_layer2, None, -1) |
40 |
| - pdb.gimp_image_set_active_layer(image, blur_layer2) |
41 |
| - blur_layer2.mode = SUBTRACT_MODE |
| 37 | + layer_sub = pdb.gimp_image_merge_down(image, layer_copy, 0) |
| 38 | + layer_sub.name = "RIS_SUBTRACT" |
| 39 | + layer_sub.mode = SUBTRACT_MODE |
42 | 40 |
|
43 |
| - copy_layer2 = pdb.gimp_layer_new_from_visible(copy_image, image, "CopyOrig2") |
44 |
| - pdb.gimp_image_insert_layer(image, copy_layer2, None, -1) |
45 |
| - pdb.gimp_image_set_active_layer(image, copy_layer2) |
46 |
| - copy_layer2.mode = ADDITION_MODE |
| 41 | + layer_copy = pdb.gimp_layer_new_from_visible(image_copy, image, "CopyOrig") |
| 42 | + pdb.gimp_image_insert_layer(image, layer_copy, None, -1) |
| 43 | + pdb.gimp_image_set_active_layer(image, layer_copy) |
47 | 44 |
|
48 |
| - #pdb.gimp_image_merge_down(image, blur_layer, 0) |
| 45 | + layer_blur = pdb.gimp_layer_new_from_visible(image_blur, image, "ResizeBlur") |
| 46 | + pdb.gimp_image_insert_layer(image, layer_blur, None, -1) |
| 47 | + pdb.gimp_image_set_active_layer(image, layer_blur) |
| 48 | + layer_blur.mode = SUBTRACT_MODE |
49 | 49 |
|
50 |
| - pdb.gimp_image_delete(copy_image) |
51 |
| - pdb.gimp_image_delete(blur_image) |
| 50 | + layer_plus = pdb.gimp_image_merge_down(image, layer_blur, 0) |
| 51 | + layer_plus.name = "RIS_ADDITION" |
| 52 | + layer_plus.mode = ADDITION_MODE |
| 53 | + |
| 54 | + pdb.gimp_image_delete(image_copy) |
| 55 | + pdb.gimp_image_delete(image_blur) |
52 | 56 |
|
53 | 57 | pdb.gimp_image_scale(image, width, height)
|
54 | 58 |
|
|
0 commit comments