Platforms to show: All Mac Windows Linux Cross-Platform

JPEGStringToPictureMBS(buf as string) as picture

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method JPEG MBS Images Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads a picture from a JPEG file.
Example
dim s as string
dim h as new HTTPSocket

s=h.Get("http://www.monkeybreadsoftware.de/xojo/images/rbplugin.jpg",90)

Backdrop=JPEGStringToPictureMBS(s)

Short version of the "JPEGStringToPicture(buf as string,allowdamaged as Boolean) as picture" method. allowdamaged is set to false.

See also:

Some examples using this global method:

Some FAQ entries about this method:

JPEGStringToPictureMBS(buf as string,allowdamaged as Boolean) as picture

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method JPEG MBS Images Plugin ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads a picture from a JPEG file.
Example
dim p as Picture = LogoMBS(500)
dim s as string = PictureToJPEGStringMBS(p, 80)

s = leftb(s, lenb(s)-1000) // remove last 1000 bytes

dim q as Picture = JPEGStringToPictureMBS(s, true)

Backdrop = q

This methods should read all JPEG file data you can get, but I've only tested it for 32 bit color and 8 bit grayscale.

I wrote it mainly because Xojo's built in OpenAsJPEG code crashes badly if your picture is not full downloaded. For example if you have a webbrowser you can now show JPEGs while you download them. Normally you can see a good picture allready with 50% of the data.

Xojo's OpenAsPicture in contrast crashes if the picture is not 100% downloaded or instead of a crash you get a white picture.

See the "JPEGToString example", "jpeg load crashtest" and "SaveJPEG without QuickTime" examples.

See also:

Some examples using this global method:

Some FAQ entries about this method:

Blog Entries

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


The biggest plugin in space...