Bug 103424 - Make parts of inserted images transparent (e.g background)
Summary: Make parts of inserted images transparent (e.g background)
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
5.2.2.2 release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-23 06:48 UTC by Dominik von Rohr
Modified: 2018-12-13 09:08 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Images of the remove background functionality in PP (667.17 KB, application/zip)
2017-01-11 07:18 UTC, Dominik von Rohr
Details
Example of remove background (136.08 KB, image/png)
2017-01-16 09:43 UTC, Heiko Tietze
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dominik von Rohr 2016-10-23 06:48:48 UTC
a simple function like in powerpoint would be very usefull for bachground removal of an image!
I use it a lot there and its sad not to have it in libreoffice.
Comment 1 Joel Madero 2016-10-23 19:29:20 UTC
Valid request - setting to NEW.

FYI:
(1) exclamation marks indicate you're yelling or something, not entirely helpful if the goal is to get people to care about your bug :-b

(2) Enhancements are handled entirely by volunteers, someone would have to find this interesting enough to do. All I'm doing is confirming it's a valid request, not saying it'll be implemented. It may be implemented relatively quickly (if someone finds it interesting) or it may never be implemented.
Comment 2 Heiko Tietze 2016-10-27 08:38:25 UTC
This function is better placed at the main and the context menu. In a pinch also at the toolbar. As a potentially destructive function it needs to be undo-able (which is the fact today).
Comment 3 Regina Henschel 2016-12-25 00:14:55 UTC
The sidebar has already the item "none" in the field "Background" of the page-properties panel. Why do you need an additional button there?
Comment 4 Heiko Tietze 2016-12-27 09:56:26 UTC
(In reply to Regina Henschel from comment #3)
> The sidebar has already the item "none" in the field "Background" of the
> page-properties panel. Why do you need an additional button there?

Oups, that's true! WFM.
Comment 5 Dominik von Rohr 2016-12-27 16:58:53 UTC
Hello all
I saw your comments on my topic and realized, that it obviously was not clear what I meant.
I did not speak about a slide background. This one can easily remove in LO. I w
Was speaking about a function to remove the background of an image added to a slide. For example if I add an image of a dog in front of a blue wall, i can use this function to remove everything that's blue (make it transparent) and have just the dog on my slide.
Best regard and happy new year! :-)
Comment 6 Regina Henschel 2016-12-27 17:18:16 UTC
Hi Dominik, that is the "Color Replacer" in menu "Tools" in Impress or Draw. It is .uno:BmpMask. But I have not tested, whether the command opens the dialog. The dialog has more options than "Set Transparent Color" in PowerPoint.

In case you do not meant "Set Transparent Color", please give a detailed description of the feature in PowerPoint.
Comment 7 Dominik von Rohr 2016-12-27 18:43:18 UTC
Hello regina
I don't know the functions name in English. In german it's "freistellen"
As soon as i'm back in office on the 3.1 I will make some screenshot.
Comment 8 Dominik von Rohr 2017-01-11 07:18:38 UTC
Created attachment 130312 [details]
Images of the remove background functionality in PP

hello all
as promised (sorry for the delay) the images of the functionality i speak about.
i wish you all a good 2017
Comment 9 Heiko Tietze 2017-01-11 08:14:18 UTC
(In reply to Dominik von Rohr from comment #8)
> Created attachment 130312 [details]
> Images of the remove background functionality in PP

This "image" has errors and cannot be shown. Looks like you messed up with Image/Packed zip as the file is named 01_Privat.zip but tagged as image/jpeg. Ideally you attach just an image and binaries (zip) only when absolutely needed. The suggested way is to use the "Add an attachment" link where an input together with a file dialog button/dialog server the purpose of loading a file from the local system. Then you add a short description like "Example for issue Foo" and perhaps a comment below. Nothing else needed.
Comment 10 Heiko Tietze 2017-01-16 09:43:07 UTC
Created attachment 130468 [details]
Example of remove background

(In reply to Heiko Tietze from comment #9)
> This "image" has errors and cannot be shown.
Maxim adjusted the attachment type to zip, it works now.

The function is called "Remove background" and described here https://support.office.com/en-us/article/Remove-the-background-of-a-picture-c0819a62-6844-4190-8d67-6fb1713a12bf?ui=en-US&rs=en-US&ad=US

There is a lot of calculation behind, that starts with the identification of possible interesting parts, outlining an area per pixel, and the least difficult thing to mark the other pixels as fully transparent.

LibreOffice Draw/Impress has a color replacer (https://help.libreoffice.org/Common/Color_Replacer) that works on a certain RGB value. But you cannot remove (speak: make transparent) the, let's say white, background of your image and keep the parts inside. I could imagine that it's not too difficult to apply the function to some arbitrary area(s), but I doubt that we can "snap" those automatically.

But maybe I'm wrong and Draw has another hidden gem. 

Attached example shows the original picture on top, the state when removal of background is active, and the result below. The screenshot at the bottom is how color replacement works in Draw.

(Changing the title from "Add UNO command to quickly remove background of slide and add this to "slide properties" in sidebar" to "Remove background of images".)
Comment 11 Regina Henschel 2017-01-16 11:44:48 UTC
Such option is called "Bild freistellen" in German. In content it would be a combination of the tools "contour editor" and "color replacer". Considering how bad these two dialogs are currently maintained, I doubt, that there will be a developer who implements such tool. Nevertheless, I think it is a valid request.
Comment 12 Heiko Tietze 2018-12-12 16:03:20 UTC
Tested the "Color Replacer" again and it's very easy to make a certain color transparent. So WFM.

Furthermore, those raster image manipulation functions are better handled in specialized graphic tools.
Comment 13 V Stuart Foote 2018-12-12 17:20:29 UTC
Agree, the "Color Replacer" dialog widget can set color(s) representing image "background" transparent (or to any other color) as in OP request.  So that is WFM also.

But as Regina notes, it also would need the masking of the contour editor to prevent removing/changing color(s) within the body of the image to 

And, expect that would require edge detection beyond current capabilities to have good anti-aliasing of the result. Based on target color alone, even at 1% tolerance, replacement edge is rough. So mixed results and dependence on content of image being manipulated.

This is already simple to do in GIMP, PhotoShop or Corel Draw, and preparing image outside of LO--but would be a rough road in Draw/Impress. Does it merit the dev effort? Probably not and => WF

@Armin -- any thought as to effort, or if existing bitmap capabilities can be repurposed?
Comment 14 Heiko Tietze 2018-12-13 09:08:23 UTC
(In reply to V Stuart Foote from comment #13)
> This is already simple to do in GIMP, PhotoShop or Corel Draw...

And thereby out of scope for us, IMHO.