Notes:
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.

This method is not depending on any library! It works without QuickTime even on System 7, but as it contains everything needed this method is around 120 KB big!
(REALbasic's OpenAsPicture depends on QuickTime)

I wrote it mainly because Realbasic'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.

REALbasic'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.

Notes:
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%

This method is not depending on any library! It works without QuickTime even on System 7, but as it contains everything needed this method is around 100 KB big!
(REALbasic's SaveAsJPEG depends on QuickTime)

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.