Add Transparent Image Padding

I need a way to add transparent padding to Images and put the original image in the center of the padding. I can add the padding and the picture but not sure how to add it as transparent padding.

I have the MBS Xojo Plug-ins if that makes things easier.

Untested but wouldn’t this work, or are you talking about a different kind of transparency?

[code]dim srcPic As Picture = theOriginalUnpaddedPicture
dim padding As integer = 40

dim paddedPic As new Picture(srcPic.Width+padding2, srcPic.Height+padding2)
paddedPic.DrawPicture(srcPic, padding, padding)

//paddedPic now has a transparent area around[/code]

I am using basically the same code in my app but I get a white border around the image.

[code]Dim out As New Picture(w,h)

out.Graphics.DrawPicture(pic, (w - pic.Width)/2, (h - pic.Height)/2)

Return out[/code]

w and h are integers that specify the new image size and pic is the source pic.

I don’t know. Just tried it and get transparency.

Is this Mac, Windows…?

How do you know it’s white? I mean is it from saving the picture out, drawing it in a Canvas, looking in the debugger? Maybe the Canvas’ Transparent property is off, that’ll fill it white.

If on windows turn on GDI + and declare the picture sithout color depth to make it transparent.

I am using a Mac. It is drawing the picture on the Canvas with the padding as White… Looking in the debugger it is also white where as yours is black.

The Canvas’s Transparency is On.

EDIT:
Could it be because an image is drawn underneath the padded picture in the same canvas?

Found the problem.

The 3rd party class I was using was adding the color depth to the images that passed through it. Once I removed them, it worked great.

Thanks for the help and patience.