[Solved] Picture Macro

Creating a macro - Writing a Script - Using the API

[Solved] Picture Macro

Postby mazman » Tue Nov 09, 2010 1:43 am

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
mazman
 
Posts: 3
Joined: Tue Nov 09, 2010 1:39 am

Re: Picture Macro

Postby Zizi64 » Tue Nov 09, 2010 10:33 am

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; AOO4.0.1, LO3.6.4, LO4.2.2 on WinXPprof.SP3
Zizi64
Volunteer
 
Posts: 1783
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Picture Macro

Postby hanya » Tue Nov 09, 2010 11:50 am

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   Expand viewCollapse view
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 12.04
hanya
 
Posts: 764
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Picture Macro

Postby Zizi64 » Tue Nov 09, 2010 12:06 pm

wow!
I learned something again.
Tibor Kovacs, Hungary; AOO4.0.1, LO3.6.4, LO4.2.2 on WinXPprof.SP3
Zizi64
Volunteer
 
Posts: 1783
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Picture Macro

Postby mazman » Wed Nov 10, 2010 12:49 am

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

thanks a million
Open Office 3.2.1
Windows 7
mazman
 
Posts: 3
Joined: Tue Nov 09, 2010 1:39 am


Return to Macros and UNO API

Who is online

Users browsing this forum: Grytpype, RPG and 6 guests