It is currently Tue Jun 25, 2024 11:34 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Selected areas to separate layers script request (SOLVED)
PostPosted: Thu Jul 04, 2013 12:22 pm  (#1) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
I am requesting a script to take selections of areas of an image and place those on separate layers.
I would like the script to either work with all objects on a transparent layer (such as text letters), or a user submitted selection.

Thanks. :)

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Selected areas to separate layers script request
PostPosted: Thu Jul 04, 2013 2:10 pm  (#2) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
Attached is one I wrote some time ago for separating sprite sheets and optionally turning them into an image hose. Doesn't do selections, just breaks up all the images separated by transparency.
Saving the gih files an option, else it just creates a new image with the separated images one per layer.

It shows up under Filters->Break Apart by Alpha...

Haven't looked at it for a while, but it should still work and might meet your needs.

-Rob A>


Attachments:
DivideTransBG.scm [7.02 KiB]
Downloaded 199 times

_________________
Image
Fantasy Cartography and Mapping by RobA


Last edited by RobA on Thu Jul 04, 2013 3:53 pm, edited 1 time in total.
Top
 Post subject: Re: Selected areas to separate layers script request
PostPosted: Thu Jul 04, 2013 3:06 pm  (#3) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12531
Just tried it Rob; cool stuff. I can see this useful for isolating Paintshop tubes to make GIH brushes since tubes tend to be be compact when they create them from some of the ones I've seen. Thanks for sharing. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Selected areas to separate layers script request
PostPosted: Thu Jul 04, 2013 7:34 pm  (#4) 
Offline
GimpChat Member

Joined: Jun 04, 2013
Posts: 38
Location: South TX
I was just thinking about something like this. PaintShop Pro has a "promote selection to layer" function that would come in handy for my current project. This might help alot. :yes


Top
 Post subject: Re: Selected areas to separate layers script request
PostPosted: Thu Jul 04, 2013 9:08 pm  (#5) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
For the selection, can this not just be done with:

1) Make selection
2) Copy (ctrl+C)
3) Edit->Paste as->New Layer (bind it to a key for ease of use...)

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Selected areas to separate layers script request
PostPosted: Fri Jul 05, 2013 2:45 am  (#6) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Thanks Rob. :)
Here is what i am trying to do.I have these huge images of shapes on alpha. So i want to break apart those shapes and save each one as a brush. This is exactly what i am looking for. ;) :bigthup

However it does show in menus, and it does begin but then nothing happens.
I have an image on a transparent layer filled with gears and want to remove each gear to a separate layer or directory.
Saving as image or brush would be awesome also.

My settings
Image

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Selected areas to separate layers script request
PostPosted: Fri Jul 05, 2013 3:22 am  (#7) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Strange.
It works for a 4 letter text layer but not for a layer as i have shown. (gear image)
Image
Do i have to input EXACT number of items to isolate for it to work correctly?

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Selected areas to separate layers script request
PostPosted: Fri Jul 05, 2013 3:38 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Okay using the exact number of shapes (57), made the script run. BUT
I got 7 layers of emptiness and 1 layer with all the gear shapes.

Image

Then running it again on just the layer with gear shapes to get a GIH, i got a gimp brush pipe. :) :bigthup
BUT there was nothing in it. Just white layers.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Selected areas to separate layers script request
PostPosted: Fri Jul 05, 2013 10:12 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
:bump

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Selected areas to separate layers script request
PostPosted: Fri Jul 05, 2013 10:48 am  (#10) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12531
Rod wrote:
Okay using the exact number of shapes (57), made the script run. BUT
I got 7 layers of emptiness and 1 layer with all the gear shapes.

[ Image ]

Then running it again on just the layer with gear shapes to get a GIH, i got a gimp brush pipe. :) :bigthup
BUT there was nothing in it. Just white layers.


You have very little separation between the gears Rod; might try to play with the size threshold setting but not sure. Have a link to this gear picture; like to toy with it myself. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Selected areas to separate layers script request
PostPosted: Fri Jul 05, 2013 11:13 am  (#11) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
The issue is the gear image - There isn't enough separation of the gear images, especially with the drop shadow.

You could try using the levels tool on the alpha channel first to get rid of most of the drop shadow then try the script again.... Best I can suggest for now other than using a circular selection to select each and then manually cut/paste as new layer.

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Selected areas to separate layers script request
PostPosted: Fri Jul 05, 2013 12:15 pm  (#12) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
I had a feeling that was the case Rob. Thanks a heap for the script too.
Lyle here is the image. :)

Image

Link to the kit itself. :)
http://rickulein.deviantart.com/art/Ste ... -371606404

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Selected areas to separate layers script request
PostPosted: Fri Jul 05, 2013 12:25 pm  (#13) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12531
Used color to alpha to create a mask and this is your image without drop shadow. Ran the script, but, the best I could come up with was 34 isolated objects (way too many extracts had multiple objects in them though). :)


Attachments:
196_Zahnradelement%2001.png
196_Zahnradelement%2001.png [ 1.61 MiB | Viewed 2164 times ]

_________________
Lyle

Psalm 109:8

Image
Top
 Post subject: Re: Selected areas to separate layers script request
PostPosted: Fri Jul 05, 2013 12:58 pm  (#14) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Yep just not a good image for this script. Good script, bad image. :lol

Thanks anyways Lyle.
I extracted all of the images with their drop shadows yesterday (took forever). But i now have all of them as brushes.
At least now their is a way to extract all objects from a layer with transparency. :)
Very handy script to say the least. I am constantly extracting multiple renders from one image so this will be very useful for me at least.

Rob you rock! :)
Wish i would have known about this script a long time ago. :lol Would have saved a ton of work for sure.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Selected areas to separate layers script request (SOLVED)
PostPosted: Fri Jul 05, 2013 1:12 pm  (#15) 
Offline
GimpChat Member
User avatar

Joined: Sep 24, 2010
Posts: 12531
I agree with you Rod (RobA Rocks that is). I had more then one occasion to have needed such a way to extract individual objects too. Very much appreciate the Script-fu Rob. :)

_________________
Lyle

Psalm 109:8

Image


Top
 Post subject: Re: Selected areas to separate layers script request (SOLVED)
PostPosted: Fri Jul 05, 2013 3:39 pm  (#16) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
I've updated the script (attached) to include:
- A fuzziness parameter (The amount of feathering applied to the selection). Sliding this down from the default 100 (which is the maximum of the image w or height over 100) will get in closer to the objects but increases sensitivity to noise.
- A threshold parameter. This is how accurately the transparency will be matched, and if slid up from the default of 0 can be used to ignore semitransparent areas such as shadows. It will also have the effect of destroying antialiasing of transparency if pulled up too much.

Here is a zip of an xcf with all gears extracted to their own layers with this script (got 53 of them) and then the rest manually separated:
Attachment:
gears_manual.zip [1.51 MiB]
Downloaded 142 times

-Rob A>


Attachments:
DivideTransBG.scm [7.23 KiB]
Downloaded 146 times

_________________
Image
Fantasy Cartography and Mapping by RobA
Top
 Post subject: Re: Selected areas to separate layers script request (SOLVED)
PostPosted: Fri Jul 05, 2013 4:12 pm  (#17) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Nice Rob! Thanks a bunch. :)

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Selected areas to separate layers script request (SOLVED)
PostPosted: Fri Jul 05, 2013 4:22 pm  (#18) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
RobA wrote:
I've updated the script (attached) to include:
- A fuzziness parameter (The amount of feathering applied to the selection). Sliding this down from the default 100 (which is the maximum of the image w or height over 100) will get in closer to the objects but increases sensitivity to noise.
- A threshold parameter. This is how accurately the transparency will be matched, and if slid up from the default of 0 can be used to ignore semitransparent areas such as shadows. It will also have the effect of destroying antialiasing of transparency if pulled up too much.

Here is a zip of an xcf with all gears extracted to their own layers with this script (got 53 of them) and then the rest manually separated:
Attachment:
gears_manual.zip

-Rob A>

Rob can you post a screenshot of your settings to get that many renders? I can't seem to get it to work very well for me.

Thanks again.

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
 Post subject: Re: Selected areas to separate layers script request (SOLVED)
PostPosted: Tue Jul 09, 2013 10:12 am  (#19) 
Offline
Script Coder
User avatar

Joined: Jul 14, 2010
Posts: 697
Rod wrote:
Rob can you post a screenshot of your settings to get that many renders? I can't seem to get it to work very well for me.

Thanks again.


Can't recall, but this:
Attachment:
settings.jpg
settings.jpg [ 30.43 KiB | Viewed 2111 times ]

got all of them, with a little loss of some of the smaller teeth.

The Threshold slider reflect the amount of opacity is ignored - this can be used to eliminate the drop shadow. It reflects the 0-255 setting of the threshold slider when using select by colour.
The Fuzziness slider controls the size of smoothing applied to the selection. The default (100) was a value I chose that gets good isolation but keeps things fairly quick. Pulling it down increases the detail in the boundary when isolating objects (i.e smaller teeth).

-Rob A>

_________________
Image
Fantasy Cartography and Mapping by RobA


Top
 Post subject: Re: Selected areas to separate layers script request (SOLVED)
PostPosted: Tue Jul 09, 2013 11:12 am  (#20) 
Offline
GimpChat Member
User avatar

Joined: May 16, 2010
Posts: 14709
Location: USA
Thank you Rob for the example. That should help a ton. :)

_________________
Image
Edmund Burke nailed it when he said, "The only thing necessary for the triumph of evil is for good men to do nothing."


Top
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Script request

3

No new posts Attachment(s) How to structure single color areas

3

No new posts Attachment(s) How can I separate an into groups?

2

No new posts My shameful n00b request for help

3

No new posts Attachment(s) pm_create_a_water_drop_text.py (Issabella request) updated

17


cron

* Login  



Powered by phpBB3 © phpBB Group