[Solved] Determine if an image show up as black

Creating a macro - Writing a Script - Using the API

[Solved] Determine if an image show up as black

Postby jep » Wed Oct 30, 2019 11:41 am

Use a script that clean a combined vector and image drawing imported from PDF's.
It's not possible to avoid that some layers and areas appear as black images.

Have used MRI to try to spot any differences, and almost all images to keep appear to use UINameSingular = 'Bitmap with transparency' and the rest use 'Bitmap'.
A few of those set to 'Bitmap' aren't black and should therefore be kept.

How can one sample and spot if an image is only black in OpenOffice basic?
Last edited by Hagar Delest on Wed Oct 30, 2019 1:10 pm, edited 1 time in total.
Reason: tagged solved
OpenOffice 4.1.3 on eComStation v2.2 / ArcaOS 5.0
jep
 
Posts: 14
Joined: Wed Sep 29, 2010 4:53 pm

Re: Determine if an image show up as black

Postby RoryOF » Wed Oct 30, 2019 11:46 am

Previous reports on forum show some methods of encoding jpg files cause them to render as black when inserted into OpenOffice documents. I do not remember for certain if any solution was found for this - I think not, as the encodings were nothing to do with OpenOffice. From memory this was something to do with colorspaces used RGB/CMYK.
Apache OpenOffice 4.1.7 on Xubuntu 18.04.3 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 29869
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Determine if an image show up as black

Postby JeJe » Wed Oct 30, 2019 11:51 am

If you post a document showing the problem (in both your current threads) it might give people a better chance of helping you.
Openoffice 4.1.2
Windows 8
JeJe
Volunteer
 
Posts: 626
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determine if an image show up as black

Postby jep » Wed Oct 30, 2019 12:40 pm

And the solution took me all day, but here it is!
Code: Select all   Expand viewCollapse view
...
         ElseIf drawobject.ShapeType = "com.sun.star.drawing.GraphicObjectShape" Then
            'This part is also a problem as Bitmap images appear in black while "Transparent Bitmap" appear as they should except one Transparent Bitmap that show up as "Bitmap", strange.
            If drawobject.FillColor = RGB( 207, 231, 245 ) And drawobject.UINameSingular = "Bitmap" Then
               Dim bmp() As Byte
               bmp = drawobject.GraphicObjectFillBitmap.getDIB()
            If 0 = bmp( LBound( bmp ) + 1078 ) Then
                  oDrawPage.remove( drawObject )
               EndIf
            EndIf
         EndIf
OpenOffice 4.1.3 on eComStation v2.2 / ArcaOS 5.0
jep
 
Posts: 14
Joined: Wed Sep 29, 2010 4:53 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 5 guests