Ask Your Question

how do i resize an image in pixels

asked 2018-03-10 21:30:42 +0200

JohnSFoster gravatar image

How do you resize images in pixels?

edit retag flag offensive close merge delete


Hm, what do you mean by that? Insert image in Writer or Draw and resize it by using pixels as measure unit? Think it can't be done, not in pixels. What you could do is use external image processing program like GIMP and resize image with that insert it in LibreOffice. Edit question to make it more precise and clear what you need to do.

Kruno gravatar imageKruno ( 2018-03-11 10:15:01 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2018-03-12 07:27:18 +0200

librebel gravatar image

Hello @JohnSFoster,

To resize an image so that it occupies ( N x M ) pixels on the active screen, you could use the Basic macro specified below.

Please note that the size of a pixel is not fixed, but can vary from device to device;

So if you use this macro to resize your image, and then export the image to another device, it will still have the same physical size but will not necessarily occupy the same ( N x M ) pixels on that device also.

Sub setSize_Pixels( oShape As Object, lHPixels As Long, lVPixels As Long )
REM Set the size of the specified Shape to ( H x V ) pixels on the active screen.
    If IsNull( oShape ) Or Not hasUNOinterfaces( oShape, "" ) Then Stop
    Dim aNewSize As New   
    aNewSize.Width  = lHPixels * TwipsPerPixelX * 127 / 72  REM converted to mm/100
    aNewSize.Height = lVPixels * TwipsPerPixelY * 127 / 72
    oShape.setSize( aNewSize )
End Sub

With Regards, lib

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-03-10 21:30:42 +0200

Seen: 423 times

Last updated: Mar 12 '18