WebPicture.Constructor(Source as Picture, Format as String="public.png")
From Xojo Documentation
Constructor
Creates a WebPicture from the passed Source Picture in the format specified by Format. Format is one of the Picture format class constants and defaults to PNG. By supplying a different format than the original picture format of the file, you can convert the picture to a new format.
Notes
The following table gives the values of the available picture format constants and their values.
Class Constant | Value |
---|---|
FormatBMP | com.microsoft.bmp |
FormatGIF | com.compuserve.gif |
FormatJPEG | public.jpeg |
FormatPNG | public.png |
FormatTIFF | public.tiff |
Example
Convert a Picture, created at runtime to a WebPicture to display using a WebImageView:
Var p As New Picture(100, 100, 32)
p.Graphics.ForeColor = &c0000ff // Blue
p.Graphics.FillRect(10, 10, 50, 50)
Var wp As New WebPicture(p)
ImageView1.Picture = wp
p.Graphics.ForeColor = &c0000ff // Blue
p.Graphics.FillRect(10, 10, 50, 50)
Var wp As New WebPicture(p)
ImageView1.Picture = wp
To instead create the picture as a JPEG, use this code: