Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

BinaryStringtoPictureMBS(data as String) as Picture
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Graphics & Pictures MBS Picture Plugin Yes Yes Yes Yes No
Function: Creates the picture back from the binary data inside the string.
Example:
dim pic as Picture = LogoMBS(500)

// encode
dim s as string = PicturetoBinaryStringMBS(pic)

// decode
Backdrop = BinaryStringtoPictureMBS(s)
Notes:
Deprecated. Please do not use for old projects and convert existing images into a new format, e.g. PNG.

The format of the binary encoded picture data:

+ 0 Kenn, PPIC for Packed Picture
+ 4 Length of whole block
+ 8 Width (BigEndian)
+12 Height (BigEndian)
+16 Depth (BigEndian, 32 for 32bit)
+20 Offset of the binary data. maybe 40.
+24 Reserved for future use. Should be 0.
+40 Pixel Data, packed R, G, B in one byte per Subpixel.

300x300 Pixels will make up 300*300+40 -> 270040 Bytes.

This method does not require Quicktime or any other OS Service, but it does no compression.

May be a good way to store pictures crossplatform inside a database. As Valentina can do its own Zip based compression, this may be a wonderfull way to store pictures uncompressed (or lossless compressed) inside the database.
Does not handle mask or alpha channel.

Some examples using this method:

Feedback, Comments & Corrections

PicturetoBinaryStringMBS(p as picture) as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Graphics & Pictures MBS Picture Plugin Yes Yes Yes Yes No
Function: Creates a string with the picture content for saving.
Example:
dim s as string
dim pic as picture = LogoMBS(100)

s=PicturetoBinaryStringMBS(pic)
Notes:
Deprecated. Please do not use for old projects and convert existing images into a new format, e.g. PNG.

The format of the binary encoded picture data:

+ 0 Kenn, PPIC for Packed Picture
+ 4 Length of whole block
+ 8 Width (BigEndian)
+12 Height (BigEndian)
+16 Depth (BigEndian, 32 for 32bit)
+20 Offset of the binary data. maybe 40.
+24 Reserved for future use. Should be 0.
+40 Pixel Data, packed R, G, B in one byte per Subpixel.

300x300 Pixels will make up 300*300+40 -> 270040 Bytes.

This method does not require Quicktime or any other OS Service, but it does no compression.
Does not handle mask or alpha channel.

May be a good way to store pictures crossplatform inside a database. As Valentina can do its own Zip based compression, this may be a wonderfull way to store pictures uncompressed (or lossless compressed) inside the database.

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

Some examples using this method:

Feedback, Comments & Corrections

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




Links
MBS Xojo PDF Plugins