GIMP, почему «Размер границы слоя» всегда возвращает смещения как ноль

344
Ome Twi

Я использую GIMP (2.8.14), в файле PSD, когда я выбираю слой, его границы выделяются желтой линией.

Инструмент Layer Boundary Sizeвозвращает (правильную) ширину и высоту, но смещения всегда равны нулю.

Есть ли способ (или плагин), чтобы найти эти смещения?

0
Это не инструмент, в терминологии GIMP. И диалоговое окно, которое появляется в этом пункте меню, предназначено только для изменения размера слоя, а смещение - для перемещения его в пределах получающегося размера. Это не смещение по краям изображения. Michael Schumacher 8 лет назад 0

1 ответ на вопрос

0
Michael Schumacher

There is the procedure gimp-drawable-offsets. If called with a layer id, it will return the offsets in x- and y-direction as a list.

Example via the Script-Fu console:

> (gimp-layer-set-offsets 2 42 23) (#t) > (gimp-drawable-offsets 2) (42 23) 

The first command offsets the layer with id 2 by 42 pixels in x- and 23 pixels in y-direction. The layer id is an educated guess I made; for real purposes you'd have to determine a suitable id, e.g. the currently active layer: gimp-image-get-active-layer.

The second command return the offsets as a list, in order to access them as numbers you can use the standard Scheme procedures car and cdr (and their concatenation shortcuts, such as cadr):

> (car (gimp-drawable-offsets 2)) 42 > (cadr (gimp-drawable-offsets 2)) 23