[Solved] Picture Macro

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
mazman
Posts: 3
Joined: Tue Nov 09, 2010 1:39 am

[Solved] Picture Macro

Post 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.
Last edited by mazman on Wed Nov 10, 2010 12:50 am, edited 1 time in total.
Open Office 3.2.1
Windows 7
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Picture Macro

Post 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)
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Picture Macro

Post 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
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
User avatar
Zizi64
Volunteer
Posts: 11359
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Picture Macro

Post by Zizi64 »

wow!
I learned something again.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
mazman
Posts: 3
Joined: Tue Nov 09, 2010 1:39 am

Re: Picture Macro

Post by mazman »

your a champion! even picked the border that i use!

thanks a million
Open Office 3.2.1
Windows 7
Post Reply