selection


How to shrink selection from two sides in GIMP script?


I need to shrink selection in my GIMP script.
Default shrink selection command shrinks the whole selection by given size value in pixels.
(gimp-selection-shrink inImage 2)
This would shrink selection by 2 pixels.
But I don't want to shrink the whole selection. I just want to remove selection from left and right side, keeping vertical selection unmodified.
That requires removing the farthest pixels on each side (left and right) from selection mask.
How can I do that?
Script desired effect for value "3px":
https://media.giphy.com/media/l3q2v50vsk8Ze8Ldu/source.gif
As you can see, it's quite rectangular on left and right side and it's required for user to make a selection like this.
So I think a good approach would be to get left and right posX of selection mask and cut the rect with height of the layer and width of pixels we want to cut off on each side of selection mask.
I'd like to use Script-Fu instead of Python-Fu, because I don't like have extra requirements for the users.
Save your selection
Get the bounding box (gimp-selection-bounds)
Shrink that box (+2px to Xmin, -4px to width)
Create a rectangle selection from these new values
Intersect with saved selection

Related Links

Unselect all sections when “Custom” InstType is chosen
Drawing transform independent layout bounds in JavaFX
How to perform rank based selection in a genetic algorithm?
Copy-paste of selections with Xlib in X11: XA_TARGETS array of atoms
Selecting who should breed with whom from a list of qualified parents?
programmatically change selected rows in a slickgrid
dgrid selection- select row only when I click on check box
Getting the Root-Element of an EObject which is being listened in a Tree-/Tableviewer
Rangy expands for cyrillic
Couldn't find box selection in Jdeveloper
In SAS, calculate value using conditional logic with different variables
Disable Text Selection in Chromium Embedded?
Retrieving Selection Data from Applications other than xterm
How to activate selected text replacement when typing new text?
GIMP: Subtract overlapping selections
Opencart: Add extra features under the same product

Categories

HOME
artificial-intelligence
matrix
automapper
verification
yaml
schema.org
couchdb
redmine
systemd
compilation
odata
apk
android-emulator
liferay-7
gprs
kurento
smooks
createjs
feature-extraction
live-streaming
smartgwt
dhcp
closures
string-formatting
bluemix-mobile-services
spyder
kamailio
gollum-wiki
qa
function-points
router
unrar
openbravo
annotation-processing
bobo-browse.net
amazon-cloudtrail
laravel-4.2
splunk-query
premake
char-pointer
wdk
numerics
pdfnet
sspi
netapp
system-on-chip
permission-denied
gestures
dblink
ltrace
perl-data-structures
jsf-2.3
p6spy
nunit-console
phpquery
self
mousehover
lowercase
wso2ml
kefir.js
wicked-gem
android-audiomanager
mod-auth-openidc
google-hangouts
uno
sunos
multivariate-testing
jini
typesafe-stack
assetic
facebook-game-groups
codahale-metrics
coalesce
reentrancy
session-0-isolation
xcode4.5
getproperty
kobold2d
nsfont
wcf-callbacks
will-paginate
motodev-studio
haiku
tablet-pc
ixmldomdocument
android-input-method
principles
zend-test
google-translator-toolkit
fxruby
external-sorting
eai
service-factory

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App