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

Arcpy - Selecting Attribute and adding attributes to a feature class
Selecting multitple, specific lines in Sublime Text using the keyboard
Genetic Programming : Difference between Roulette Rank and Tournament Selection
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

Categories

HOME
python-2.7
oracle
class
vagrant
focus
yii
enums
transactions
add-on
ews
plpgsql
apk
bing-search
autocomplete
elisp
facebook-android-sdk
angular2-template
azure-logic-apps
bellman-ford
hystrix
watch-os-3
fbloginview
jodatime
jpa-2.0
closures
mixpanel
hidden
spam
bluemix-mobile-services
weex
web-analytics
restier
ratio
unordered-multimap
python-appium
beego
android-cardview
pyspark-sql
social-networking
credit-card
publishing
argv
quickcheck
nest
directfb
char-pointer
transform
landscape
formsauthenticationticket
bluemixtools
mv
text-decorations
selenide
microkernel
netapp
slideshow
resampling
flipkart
robust
optionaldataexception
reverse-dns
linq-to-excel
section508
webalizer
knockout-2.0
beeline
phppgadmin
openstack-glance
asp.net-web-api-routing
1010
nrf51
nitrousio
scheduledexecutorservice
fragmentstatepageradapter
android-sdcard
right-to-left
adp
simian
jeasyui
management-studio-express
certificate-authority
webgrind
variable-length-array
openshift-cartridge
asp.net-web-api-helppages
abstract-factory
clarion
jolie
sunos
igor
oracle-adf-mobile
cidr
tabletools
windows-taskbar
san
ember-table
cmath
gprof
getproperty
border-box
taskkill
platform-independent
autosize
navigationcontroller
net-use
getopts
sql-parametrized-query
regression-testing
git-log
uninstaller
asdoc
browser-based
mysqli-multi-query
yahoo-maps
downcasting
rakudo
efs

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