How do i resize an image in pixels

How do you resize images in pixels?

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.

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, "com.sun.star.drawing.XShape" ) Then Stop
	Dim aNewSize As New com.sun.star.awt.Size	
	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