harold Posted September 5, 2012 Posted September 5, 2012 (edited) "Content Aware Resize" is a little effect I've written in a couple of hours that uses Seam Carving to make an image less wide in a way that somewhat respects the content. It probably shouldn't really be an effect because it effectively changes the size of the picture, but there is little choice.. so it just leaves some transparent space, which works well enough. As you can see in the source, I use an ugly hack to render only once. It's fundamentally impossible to render it in parts - it has to calculate the globally least-energy seam, which means it has to look at the entire image all at once (well the entire selection really, but I had no idea how to do that). Once it knows the seam it could theoretically build the output row by row, I suppose. Is there a good way to render just once, preferrably in a way that handles rectangular selections? edit: I know the code is lame and I recalculate far too much for every seam, I'll fix that later.. ContentAwareResize.zip Edited September 5, 2012 by harold Quote I would write plugins, if I knew what kind of plugins were needed..
pyrochild Posted September 5, 2012 Posted September 5, 2012 You can override OnSetRenderInfo() and do your rendering in there instead of Render(). Keep in mind that this will make Paint.NET's progress bar useless (it'll be stuck at 0% while your plugin works, then jump to 100% when done) so try to keep things snappy. Quote ambigram signature by Kemaru [i write plugins and stuff] If you like a post, upvote it!
harold Posted September 5, 2012 Author Posted September 5, 2012 Isn't still a bit of a hack? Quote I would write plugins, if I knew what kind of plugins were needed..
Ego Eram Reputo Posted September 5, 2012 Posted September 5, 2012 It probably shouldn't really be an effect because it effectively changes the size of the picture, but there is little choice.. so it just leaves some transparent space, which works well enough. Your effect changes the size of the image, but not the canvas or selection region. This is perfectly OK. Several effects do exactly that. Filling the excess with transparent pixels is the natural consequence to the resizing operation so that isn't a problem either. Processing your heavy calculations in OnSetRenderInfo() is the preferred method, not a hack. See Rick's post here: http://forums.getpai...in/#entry358957 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
harold Posted September 6, 2012 Author Posted September 6, 2012 Ok thanks. Putting it in OnSetRenderInfo. Quote I would write plugins, if I knew what kind of plugins were needed..
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.