Macro pyuno export png (with transparency)

I want to export a transparency png image in draw. How do I export png file using FilterData to set “Save Transparency”(like the UI below)
wm

self.exporter = self.createUnoService("com.sun.star.drawing.GraphicExportFilter")
output_props = {
    "URL": output_path,
    "MimeType": "image/png"
}
output_props = self._to_PropertyValues(output_props)
self.exporter.setSourceDocument(controller.Selection)
self.exporter.filter(output_props)

Try property Translucent (value True / False).

1 Like

@sokol92 any chance you could link to the documentation for this for anyone searching this forum in the future? I can’t find it.

what’s your meaning?

me? I can’t locate any documentation that specifies the property translucent option and since @sokol92 knew the answer I was hoping they’d also know where to find it.

Method of deduction (according to S. Holmes). :slight_smile:

  1. In this message on a similar topic we look at the names of the properties that are formed when exporting in the .png format. The most plausible for transmitting transparency is Translucent.
  2. A forum search for the word Translucent confirms that we are on the right track.
  3. Finally, searching for the same word in the LO source code yields a list of possible properties for FilterData. Unfortunately, C++ is not my strong point…
1 Like

such options is unclear to developer, maybe java reference exists in opendocument. it takes time to explore and try.

1 Like

A coincidence: tdf#162529 filed 2024-08-20, fixed 2024-08-26: Welcome to the LibreOffice Writer Help (will appear soon).

1 Like

Thanks @sokol92. Since S. Holmes had to piece together all that information to find an answer I guess there isn’t a documented reference for all these options - which answers my question. I’m kind of surprised actually, but it may be a way for me to contribute to the project if I can extract that info from the source perhaps. I think there should be documentation for this. Thanks for your help. :+1:

@mikekaganski thanks for this info. It seems these references are scattered through the help files and not necessarily easy to reference particularly if writing a macro or interacting with python etc. Do you know whether there has been any discussion on consolidating this type of reference into a lookup table or similar? I was thinking a table with all possible options listed and columns pertaining to command-line, python, basic, etc (presumably python, basic, etc would all be the same but I guess not all options are available via command line).

As an inexperienced C++ developer, also in Java(which follows C++ programmimg style of majority). In OOP programming code, developer are used to adding property with a prefix “m”(which means member), so it is easy to extract such options in source code (refered by *.hxx)
When you find a possible solution in this website, you can locate the source code quickly and find some useful information.

This is helpful, but I wonder how many people aren’t able to get the full potential from LO macros, coding, etc, because they don’t know to (or know how to) search the source code (myself included until today). In my mind it should be documented in an easy to read reference list at minimum but ideally also linked to the relevant help sections if they exist.

Happy to look into doing this as it would be a great learning opportunity for me also but would need some guidance from more experienced people like yourself. Thoughts?

These have nothing to do with Basic/Python. They are rather API.

See also: How to set the Selection parameter to convert to pdf using the command line - #9 by mikekaganski - it explains that we included even non-command-line options to the documentation.
See also: tdf#98153, and its See Also bugs, where we created help pages for command line export options for CSV, dBase, DIF, PDF, and now for raster images (“scattered”, as you were so kind to call it - thanks).
If you have an improvement in mind, then just join and do it. No need to ask others’ permission.

So I should be able to find reference to the property translucent in the API documentation?

I wasn’t asking permission, just trying to understand the problem of missing documentation (or whether it’s missing at all) and the best way to go about it since I’m new to this space and others may have differing ideas and information I dont’ have.

If you mean to ask if there is already this information in the API documentation: no there is not. What I meant to tell was, that this information should not be put somewhere in the “Basic help” or “Python help” sections, but rather, in API documentation.

:+1: Excellent, this is what I was trying to understand. Just found a page on the OpenOffice Wiki that explains that “The dispatch commands are an internal mechanism of Apache OpenOffice. The arguments of each dispatch command are not documented.”. So I imagine that is still the case for LibreOffice.

https://wiki.openoffice.org/wiki/The_OpenOffice.org_recorder_and_UNO_dispatch_calls

As I already shown you, we document them - at least in command line documentation, so it is not “the case for LibreOffice”. I would kindly ask you to not nullify what others have already done. Thank you.

No need to imaginate stuff, when google can find the answer easily with
“LibreOffice dispatch commands”
.
Continue here:
https://wiki.documentfoundation.org/Development/DispatchCommands

1 Like

You have completely misunderstood my intentions. I am merely trying to understand what is currently available and where so I can use it and if it doesn’t exist so perhaps I can help create it. I’m trying to do the opposite of nullify it but I don’t seem to be able to explain this in a way where anyone can point me in the right direction to either existing documentation or a good way to create it.

I understand some of it is documented as in your example but that is just one example and there doesn’t appear to be a consolidated list of variables other than within the source code (from the answers I have been given here).

I literally linked that in the same reply you’re replying to.

Please - I am just trying to understand where the documentation exists and if it doesn’t then is there a reason there isn’t a consolidated list of variables that can be used? Please don’t go putting words in my mouth, I have only asked questions and seek to understand what I do not currently know and cannot find via searches.