[Solved] Determine if an image show up as black

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
jep
Posts: 22
Joined: Wed Sep 29, 2010 4:53 pm

[Solved] Determine if an image show up as black

Post by jep »

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
Apache OpenOffice 4.1.13 on ArcaOS 5.0.7
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Determine if an image show up as black

Post by RoryOF »

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.15 on Xubuntu 22.04.4 LTS
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Determine if an image show up as black

Post by JeJe »

If you post a document showing the problem (in both your current threads) it might give people a better chance of helping you.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
jep
Posts: 22
Joined: Wed Sep 29, 2010 4:53 pm

Re: Determine if an image show up as black

Post by jep »

And the solution took me all day, but here it is!

Code: Select all

...
         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
Apache OpenOffice 4.1.13 on ArcaOS 5.0.7
Post Reply