SixLabors / ImageSharp

:camera: A modern, cross-platform, 2D Graphics library for .NET
https://sixlabors.com/products/imagesharp/
Other
7.4k stars 852 forks source link

Managed version of content-aware resizing #2

Open JimBobSquarePants opened 7 years ago

JimBobSquarePants commented 7 years ago

From @KvanTTT on April 26, 2015 13:33

There is managed implementation of CAIR seam carving (content-aware) algorithm: Seam-Carving-Advanced.

It it possible to port it to your library. Is it necessary?

Copied from original issue: JimBobSquarePants/ImageProcessor#158

JimBobSquarePants commented 7 years ago

A managed implementation would be amazing! :smile: I've been really unhappy with the way I've had to implement seam carving at the moment.

JimBobSquarePants commented 7 years ago

Would this be something you would be interested in adding to V3?

JimBobSquarePants commented 7 years ago

From @KvanTTT on December 1, 2015 15:6

I'am not interested in this library in near future :( I'am doing another things.

JimBobSquarePants commented 7 years ago

From @dampee on December 1, 2015 15:52

@KvanTTT how difficult would it to port?

JimBobSquarePants commented 7 years ago

From @KvanTTT on December 1, 2015 16:43

@dampee, I think it is not difficult. The only thing my library is using unsafe code snippent for performance reason (this may not compatible with Mono and some devices, but it can be removed). Are they allowed in ImageProcessor?

JimBobSquarePants commented 7 years ago

@KvanTTT There's tons of unsafe code in Corefx https://github.com/dotnet/corefxlab/search?utf8=%E2%9C%93&q=unsafe so I'm not opposed to using it in ImageProcessor.

I avoided it before as I was targeting some old PCL stuff (WP8) which didn't support it but I'm sure now there are places within my codebase which could benefit. Would need lots of testing to determine where though.

@dampee If you're gonna attempt a port I would test unsafe vs safe blocks to see whether there is a speedup since we're not using System.Drawing anymore. It may be the case that it could even slow things down.

JimBobSquarePants commented 7 years ago

From @dampee on December 2, 2015 0:17

Don't worry (yet). I'll touch first some simple things by the end of the year. Just looking around what I can do. (But too busy right now for customers)

shapeh commented 8 months ago

Not sure if seam carving would work for my issue (i.e. content-aware resizing) - it seems SC can change (redesign) e.g. a car so it no longer looks like the original, if the there's too much repetition in the image.

Added some discussion here: input https://github.com/SixLabors/ImageSharp/discussions/2627