katust Posted February 4, 2017 Share Posted February 4, 2017 I continually use the same template for projects and always move the exact same selected areas to the same places. In the picture provided, I give an example of how I may move my selection. In the colored top block, I break it up into two even slices and move them to another location. Basically what I am looking for is a way to say "Move top selection ###, ###. Bounding rectangle size ### x ### to location --> top selection ###, ###. If that does not make sense, please let me know because I am determined to find a quicker way since I have been doing this manually for years. I need a script or plugin that will save me tons of time! Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted February 4, 2017 Share Posted February 4, 2017 That is possible, but you wouldn't do it with selections. Do you have basic programming skills? You write a script/plugin with CodeLab. If not, I or someone else will be able to assist. Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
Rick Brewster Posted February 4, 2017 Share Posted February 4, 2017 Plugins can't affect selections 1 Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
katust Posted February 4, 2017 Author Share Posted February 4, 2017 29 minutes ago, toe_head2001 said: That is possible, but you wouldn't do it with selections. Do you have basic programming skills? You write a script/plugin with CodeLab. If not, I or someone else will be able to assist. How would I do it without selections? Haha, the only programming I know is HTML and CSS so I'm a newb. If someone were to write a little bit of the script, I could probably finish it since I am a quick learner. Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted February 4, 2017 Share Posted February 4, 2017 Just now, katust said: How would I do it without selections? Instead of defining the Bounding Rectangle with a selection, you define it programmatically. You said you're continually using the same template, so the values of the Bounding Rectangle could even be hard-coded. I'll see what I can come up with this weekend. It should be pretty straightforward. Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
katust Posted February 4, 2017 Author Share Posted February 4, 2017 1 minute ago, toe_head2001 said: Instead of defining the Bounding Rectangle with a selection, you define it programmatically. You said you're continually using the same template, so the values of the Bounding Rectangle could even be hard-coded. I'll see what I can come up with this weekend. It should be pretty straightforward. Sweet! Thank you so much! With the picture I shared, it's a lot of that same idea but just all over the template. If the structure of the script were provided and one example of how to move a selection to another area, I could probably fill in the rest. Thank you for your help and advice, I truly appreciate it! Quote Link to comment Share on other sites More sharing options...
MJW Posted February 4, 2017 Share Posted February 4, 2017 I would think that if there were a plugin that could copy a specified rectangle to a specified location, it could be used with ScriptLab to do what's wanted. 1 Quote Link to comment Share on other sites More sharing options...
toe_head2001 Posted February 7, 2017 Share Posted February 7, 2017 @katust, sorry for the delay... I didn't get around to doing this until tonight. Copy and paste the script into CodeLab. The three Rectangles are based on the image template you posted. void Render(Surface dst, Surface src, Rectangle rect) { Rectangle fromRect = Rectangle.FromLTRB(229, 202, 361, 238); Rectangle toRect1 = Rectangle.FromLTRB(215, 353, 283, 389); Rectangle toRect2 = Rectangle.FromLTRB(306, 353, 374, 389); ColorBgra CurrentPixel; for (int y = rect.Top; y < rect.Bottom; y++) { if (IsCancelRequested) return; for (int x = rect.Left; x < rect.Right; x++) { CurrentPixel = src[x,y]; if (toRect1.Contains(x, y)) { int offSetX = x - toRect1.Left + fromRect.Left; int offSetY = y - toRect1.Top + fromRect.Top; CurrentPixel = src[offSetX, offSetY]; } else if (toRect2.Contains(x, y)) { int offSetX = fromRect.Right - toRect2.Right + x; int offSetY = y - toRect2.Top + fromRect.Top; CurrentPixel = src[offSetX, offSetY]; } dst[x,y] = CurrentPixel; } } } Let us know if you need further help. 2 Quote (September 25th, 2023) Sorry about any broken images in my posts. I am aware of the issue. My Gallery | My Plugin Pack Layman's Guide to CodeLab Link to comment Share on other sites More sharing options...
hanzon73 Posted November 29, 2017 Share Posted November 29, 2017 I have no experience at running scripts with paint.net. This seems to look as a sollution to what I need. I need a script that creates a fixed size selection in the center of the image. The script has to be called by the same script that opens the image in paint.net, including the width and height of the selection. Can that be done? What tools/programs would I need to support this? (It should work with multiple users). Thanks in advance! Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted November 29, 2017 Share Posted November 29, 2017 Plugins cannot open images. They get access to the active layer (or a selection on it if one is active). If you're OK with opening your image and running a plugin, what do you want done with the central area once you have defined it? Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
hanzon73 Posted November 30, 2017 Share Posted November 30, 2017 9 hours ago, Ego Eram Reputo said: Plugins cannot open images. Is it possible to call a plug in from a script or command line? 9 hours ago, Ego Eram Reputo said: what do you want done with the central area once you have defined it? The user needs to move the selection to a section of choice and then crop to selection. For a command line something like > scribus.exe [file] -[script] Ideally the size of the selection would be a given parameter (like "-size 600x600"). Or I simply copy the plugin scripts to various sizes. In more detail: We need all images to have a specific dimension (lets say 600x600) I am using "magick" to resize all input images (so 1800x1200 will become 900x600, 1200x1500 will become 600x750) etc. Then the user need to select what part should be in the 600x600 and what part can be shaved. Quote Link to comment Share on other sites More sharing options...
MJW Posted November 30, 2017 Share Posted November 30, 2017 16 hours ago, hanzon73 said: Is it possible to call a plug in from a script or command line? Scripts are run by plugins (mostly pyrochild's ScriptLab), so while a script can run another plugin, it can't do anything a plugin can't do. Things plugins (and therefore scripts) can't do include: opening a file into Paint.Net; creating or modifying a selection; cropping an image, or otherwise resizing an image's canvas. 16 hours ago, hanzon73 said: The user needs to move the selection to a section of choice and then crop to selection. Plugins can move pixels from one region to another, but they can't modify the selection boundary, and they can move pixels to a region outside the selection, since only the pixels inside the current selection can be written. They also can't crop an image. I suspect you'll have to find a program other than PDN to do what you want to do. Quote Link to comment Share on other sites More sharing options...
Ego Eram Reputo Posted November 30, 2017 Share Posted November 30, 2017 Completely agree with MJW. Paint.net isn't designed to be used this way. Although, thinking about it, I suggest you have a look at this.... Quote ebook: Mastering Paint.NET | resources: Plugin Index | Stereogram Tut | proud supporter of Codelab plugins: EER's Plugin Pack | Planetoid | StickMan | WhichSymbol+ | Dr Scott's Markup Renderer | CSV Filetype | dwarf horde plugins: Plugin Browser | ShapeMaker Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.