Platforms to show: All Mac Windows Linux Cross-Platform

PictureToJPEGStringMBS(pic as picture, quality as Integer = 80) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method JPEG MBS Images Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Saves a picture into a string using JPEG compression.
Example
dim p as Picture = LogoMBS(500)
dim s as string = PictureToJPEGStringMBS(p, 80)
dim q as Picture = JPEGStringToPictureMBS(s)

Backdrop = q

This methods saves 32bit pictures to a file using JPEG Compression. Using the parameter you can specify the quality in range between 25 and 100%

The picture should be a bitmap picture without alpha channel or mask.
Use the JPEGExporterMBS class for more options.

The returned string has the encoding set to binary (no encoding). If you want to concat the string with another you should change the encoding, so both strings have the same encoding. If you don't handle that RB may convert the JPEG data to UTF8 (Unicode) which will destroy it.

The picture is always encoded with 72 dpi. If you want to set a different dpi value, please use the JPEGExporterMBS class.

Some examples using this global method:

Some FAQ entries about this method:

Xojo Developer Magazine

The items on this page are in the following plugins: MBS Images Plugin.


The biggest plugin in space...