Scale of cropped image

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
User avatar
Evgeniy
Posts: 43
Joined: Thu Jan 09, 2020 9:31 pm
Location: Russia

Scale of cropped image

Post by Evgeniy »

I'm look API with MRI and not find Scale property of image and I came to the next decision:

Code: Select all

	" widthscale="+obj.Width/(obj.ActualSize.Width-obj.GraphicCrop.Left-obj.GraphicCrop.Right)
	" heightscale="+obj.Height/(obj.ActualSize.Height-obj.GraphicCrop.Top-obj.GraphicCrop.Bottom)
This is right way?
OpenOffice 4.1.7 OS: Win10 x32 + Win10 x64
User avatar
Zizi64
Volunteer
Posts: 11364
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Scale of cropped image

Post by Zizi64 »

Please upload your sample file with the ebedded picture and the macro code.
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.
musikai
Volunteer
Posts: 294
Joined: Wed Nov 11, 2015 12:19 am

Re: Scale of cropped image

Post by musikai »

Evgeniy wrote:I'm look API with MRI and not find Scale property of image and I came to the next decision:

Code: Select all

	" widthscale="+obj.Width/(obj.ActualSize.Width-obj.GraphicCrop.Left-obj.GraphicCrop.Right)
	" heightscale="+obj.Height/(obj.ActualSize.Height-obj.GraphicCrop.Top-obj.GraphicCrop.Bottom)
This is right way?
Seems to be correct. I used almost the same in PicTool:
https://extensions.openoffice.org/de/node/18393

Only difference is I used obj.LayoutSize.Width instead of obj.Width but can't remember the reason anymore and seems to give the same result.
Win7 Pro, Lubuntu 15.10, LO 4.4.7, OO 4.1.3
Free Project: LibreOffice Songbook Architect (LOSA)
http://struckkai.blogspot.de/2015/04/li ... itect.html
User avatar
Evgeniy
Posts: 43
Joined: Thu Jan 09, 2020 9:31 pm
Location: Russia

Re: Scale of cropped image

Post by Evgeniy »

Zizi64 wrote:Please upload your sample file with the ebedded picture and the macro code.
Thats easy to me. This code is part of my HTML exporter.

viewtopic.php?f=21&t=100807
OpenOffice 4.1.7 OS: Win10 x32 + Win10 x64
Post Reply