Page 1 of 1

[Solved] Picture Macro

Posted: Tue Nov 09, 2010 1:43 am
by mazman
Hi everyone,

I'm trying to set up a macro in open office that does some basic changes to photos.

Basically i need it to

up contrast by 25%
up brightness 25%
lower gamma to 0.7
apply border
apply wrap though

and i would like to have this as a button in the picture menu(or a keyboard short cut)

I have tried the recording feature, but it doesn't work when I run the macro, my programing knowledge is very basic but it doesn't even look like it records anything.

Re: Picture Macro

Posted: Tue Nov 09, 2010 10:33 am
by Zizi64
Basically i need it to

up contrast by 25%
up brightness 25%
lower gamma to 0.7
apply border
apply wrap though
The OpenOffice.org not a picture editing tool. You need use a real picture editor for change contrast, brightness, gamma of a picture. Try it with GIMP or other opensource (or commercial) software before you insert the picture into an OpenOffice document.

(In my opinion the modify the border of a picture (or pictures) maybe is possible in OpenOffice by basic macro)

Re: Picture Macro

Posted: Tue Nov 09, 2010 11:50 am
by hanya
I do not know what kind of border you want to set to the image, change the border according to your desired one.

Code: Select all

Sub ChangeImageAttribute
  oDoc = ThisComponent
  oSelected = oDoc.getCurrentSelection()
  If oSelected.supportsService("com.sun.star.text.TextGraphicObject") Then
    aBorder = CreateUnoStruct("com.sun.star.table.BorderLine")
    With aBorder
      .OuterLineWidth = 2
    End With
    With oSelected
      .AdjustContrast = 25
      .AdjustLuminance = 25
      .Gamma = 0.7
      .BorderDistance = 49
      .LeftBorder = aBorder
      .TopBorder = aBorder
      .RightBorder = aBorder
      .BottomBorder = aBorder
      .Surround = com.sun.star.text.WrapTextMode.THROUGHT
      .TextWrap = com.sun.star.text.WrapTextMode.THROUGHT
    End With
  End If
End Sub

Re: Picture Macro

Posted: Tue Nov 09, 2010 12:06 pm
by Zizi64
wow!
I learned something again.

Re: Picture Macro

Posted: Wed Nov 10, 2010 12:49 am
by mazman
your a champion! even picked the border that i use!

thanks a million