Jump to content

Content-Aware Resize (a.k.a. Seam Carving)


OVZh

Recommended Posts

Moderator Note: This plugin does not work with paint.net v4.1 onwards.
An alternative is @BoltBait's Seam Carving plugin:
https://forums.getpaint.net/topic/34047-boltbaits-seam-carving

 

 

 

 

This plugin implements the famous Seam Carving (or Content-Aware Resizing) technique.

 

Using it you can resize (shrink) images without distorting or loosing any significant details:

 

http://www.olegzhukov.com/content/CAR_demo.png

 

Hidden Content: Download at your own risk.

 

Current limitations (to be fixed somewhen):

  • Speed (~twice slower than the Gimp analog, probably due to C++ vs .NET performance)
  • No preview - because of low performance. May include a thumbnail preview in future releases.
  • Only shrinking (reducing size) is available now. Content-aware growing is a little bit trickier procedure (I may implement it sometime later).

Project website (with sources and more info): http://github.com/OlegZhukov/CAR.

 

Contribution (by forking/joining the project on GitHub) or any kind of feedback is very welcome!

 

Thank you,

Oleg Zhukov

Link to comment
Share on other sites

Ok, so this is a seriously awesome plugin.  I'm moving it to the developer's section because - as has been noted - it doesn't follow the plugin publishing rules, and as such is not "done."  Hopefully the developers in this subforum can help you bring it within the rules and release it as an awesome plugin!

  • Upvote 1

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

Just to clarify. I'm not saying this plugin is malware in any way. The code shows a good understanding of the internal structure of Paint.NET.

And I know it is sometimes difficult for a developer not to implement a feature which makes life easier for the users just because some rules state you are not allowed to publish it.

 

I.e. I'm using at home a variant of the 'Print It' plugin which replaces the "Print..." menu entry (In addition to the plugn it allows to print all open documents, the active one, and more). Private usage is allowed by the rules. Or let's say, Rick is realistic enough to say: I don't care.

 

But not using the official API adds additional risks of side effects and the application may behave strange or crash.

midoras signature.gif

Link to comment
Share on other sites

Indeed.  "At your own risk" in this case largely means "you may lose track of or miss some features, and this plugin may stop working next release."

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

I'm pretty sure that a lot of people like to get this feature.

But did you read the rules what a plugin is allowed to do?

 

Hi Midora,

 

Thank you for pointing the rules out to me. I should have done more research and read them before posting.

 

Initially I was trying to stay within the standard Paint.NET plugin programming model, but I found it impossible to change the canvas size using the standard interface provided to plugins.

 

Anyway even if it cannot be called a conventional plugin, I would be happy if someone finds it useful :)

 

Thank you!

Oleg Zhukov

Link to comment
Share on other sites

Ok, so this is a seriously awesome plugin.  I'm moving it to the developer's section because - as has been noted - it doesn't follow the plugin publishing rules, and as such is not "done."  Hopefully the developers in this subforum can help you bring it within the rules and release it as an awesome plugin!

 

Hi David,

 

Thank you for your feedback! I wish there were permitted ways of doing what this plugin does, but I didn't find any :(. Hopefully, the plugin API would evolve and would eventually allow changing the canvas size and other things, allowing to write a legitimate version of this plugin.

 

Indeed.  "At your own risk" in this case largely means "you may lose track of or miss some features, and this plugin may stop working next release."

 

It is true that the plugin may stop working someday (after switching to some newer Paint.NET version) since I access some internal classes and members which are likely to change.

 

But I see no way it can disable or break any existing or new Paint.NET features. It may prevent newer Paint.NET versions from starting, but it doesn't selectively pluck out any of the features :)

 

Thank you!

Oleg Zhukov

Link to comment
Share on other sites

Well, you don't have to resize the canvas - just insert transparent pixels in places that are removed.  It's easy enough to shrink the canvas manually.

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

Well, you don't have to resize the canvas - just insert transparent pixels in places that are removed.  It's easy enough to shrink the canvas manually.

 

Perhaps, you're right. I initially swept aside this option, but now it looks like a reasonable trade-off, leaving a user with only one simple thing to do. Not sure whether I will implement it soon, have to switch to another work for quite a while.

 

Thank you!

Oleg Zhukov

Link to comment
Share on other sites

Or you may make something like "Render it in clipboard". On pasting from clipboard, the canvas size will be taken care by itself.

 

Hi Pratyush, 

 

This is somewhat more elegant solution than David suggested. Although it may be slightly confusing (in a sense that a user doesn't see the result immediately).

 

Thanks!

Oleg Zhukov

Link to comment
Share on other sites

Yeah. Don't mess with paint.net's internal stuff or 1) I will block your plugin, and/or 2) block whatever you're mucking with (e.g. Internal stuff). Guaranteed.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

  • 4 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...