Platforms to show: All Mac Windows Linux Cross-Platform

Back to TiffPictureMBS class.

Previous items

TiffPictureMBS.Scanlines(index as Integer, count as Integer, sample as Integer = 0, lineStepScanlines as Integer = 1, lineStepReturn as Integer = 1) as memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
property TIFF MBS Images Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Get or set image scanlines as one memoryblock.

Returns nil on any error.
If you set the value, make sure the Memoryblock is big enough. The BytesPerRow functions returns the number of bytes needed.

The data for this property is stored in the Tiff file.
The first scanline has the index of 0. Count is the number of scanlines you want to read/write.

If lineStepScanlines is >1, we skip scan lines so we read less data.
If lineStepReturn is >1, we return only every nth row.

If rows can be read with skipping, you should try lineStepScanlines = 2 or more for skipping lines.
If that doesn't work due to tiled data, you can use lineStepReturn = 2 or more.
This skipping is to quicker get preview pictures.
(Read and Write computed property)

Some examples using this property:

TiffPictureMBS.ScanlinesScaled(index as integer, count as integer, sample as integer = 0, scaleFactor as Integer = 1) as memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 19.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Get image scanlines scaled down as one memoryblock.

Returns nil on any error.

The data for this property is stored in the Tiff file.
The first scanline has the index of 0. Count is the number of scanlines you want to read/write.

If scaleFactor is >1, we scale down and return scaleFactor rows reduced to one row.

This scaling down is to quicker get preview pictures.

Some examples using this method:

TiffPictureMBS.SetColorMap(red as memoryblock, green as memoryblock, blue as memoryblock) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 9.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the color map for a paletten image.

The memoryblock must be 2^bitspersample * 2 bytes big.
Returns true on success and false on failure.

TiffPictureMBS.SetColorProfile(ProfileData as String) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 7.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the color profile for this tiff file.
Example
Dim p As New Picture(100,100,32)

Dim ImageFile As FolderItem = SpecialFolder.Desktop.Child("test.tif")
Dim ProfileFile As FolderItem = SpecialFolder.Desktop.Child("Generic RGB Profile.icc")

Dim t As New TiffPictureMBS
t.Pict = p

Dim ProfileStream As BinaryStream = BinaryStream.Open(ProfileFile)
Dim ProfileData As String = ProfileStream.Read(ProfileStream.Length)

If t.Create(ImageFile) Then
// set profile before writing
If t.SetColorProfile(ProfileData) Then
// now write picture
If t.WriteRGB Then
t.Close

ImageFile.Launch
Else
Break
End If
Else
Break
End If
Else
Break
End If

Returns true on success and false on failure.

TiffPictureMBS.SetData(Tag as Integer, data as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 8.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes the string for this tag.

TiffPictureMBS.SetFieldByte(Tag as Integer, value as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the tiff data field with the given tag to the given value.

Please look for Tag values in the tiff specification.
Returns true on success.
Please make sure to use the correct setter depending on data type associated with the tag.

TiffPictureMBS.SetFieldDouble(Tag as Integer, value as Double) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 7.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the tiff data field with the given tag to the given value.

Please look for Tag values in the tiff specification.
Returns true on success.
Please make sure to use the correct setter depending on data type associated with the tag.

TiffPictureMBS.SetFieldInteger(Tag as Integer, value as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 7.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the tiff data field with the given tag to the given value.
Example
dim t as TiffPictureMBS
dim f as FolderItem

const TIFFTAG_IMAGELENGTH=257 // integer
const TIFFTAG_IMAGEWIDTH=256 // integer

f=GetTemporaryFolderItem
t=new TiffPictureMBS

if t.Create(f) then

if t.SetFieldInteger(TIFFTAG_IMAGELENGTH,100) then
if t.Height=100 then
MsgBox "ok"
end if
end if

end if

Please look for Tag values in the tiff specification.
Returns true on success.
Please make sure to use the correct setter depending on data type associated with the tag.

Some examples using this method:

TiffPictureMBS.SetFieldMemory(Tag as Integer, ItemCount as Integer, data as memoryblock) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the tiff data field with the given tag to the given value.

This is the special version of the setter which passes a memoryblock and a count value so you can set an array using this method.

Please look for Tag values in the tiff specification.
Returns true on success.
Please make sure to use the correct setter depending on data type associated with the tag.

Some examples using this method:

TiffPictureMBS.SetFieldShort(Tag as Integer, value as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 7.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the tiff data field with the given tag to the given value.

Please look for Tag values in the tiff specification.
Returns true on success.
Please make sure to use the correct setter depending on data type associated with the tag.

TiffPictureMBS.SetFieldSingle(Tag as Integer, value as Single) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the tiff data field with the given tag to the given value.

Please look for Tag values in the tiff specification.
Returns true on success.
Please make sure to use the correct setter depending on data type associated with the tag.

TiffPictureMBS.SetFieldString(Tag as Integer, value as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 8.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets one of the fields to the value of the string.
Example
dim m,p as Picture
dim f as FolderItem
dim t as TiffPictureMBS
dim g as Graphics
dim s as string

// make pictures
p=New Picture(100,100,32)
m=New Picture(100,100,32)

p.Graphics.ForeColor=Rgb(0,255,0) // fill green
p.Graphics.Fillrect 0,0,100,100

p.Graphics.ForeColor=Rgb(255,0,0) // fill red
p.Graphics.FillOval 0,0,100,100

m.Graphics.ForeColor=Rgb(0,0,0) // fill black (invisible so green not seen)
m.Graphics.Fillrect 0,0,100,100

m.Graphics.ForeColor=Rgb(255,255,255) // fill white (Visible)
m.Graphics.FillOval 0,0,100,100

// save
f=SpecialFolder.Desktop.Child("test.tif")

t=new TiffPictureMBS
t.Pict=p
t.Mask=m

if t.Create(f) then
if t.WriteRGB then

const TIFFTAG_SOFTWARE=305

s="Example Software"
call t.SetFieldString TIFFTAG_SOFTWARE,s

const TIFFTAG_HOSTCOMPUTER=316

s="Example HostComputer"
call t.SetFieldString TIFFTAG_HOSTCOMPUTER,s

const TIFFTAG_IMAGEDESCRIPTION=270

s="Example ImageDescription"
call t.SetFieldString TIFFTAG_IMAGEDESCRIPTION,s

const TIFFTAG_MAKE=271

s="Example Make"
call t.SetFieldString TIFFTAG_MAKE,s

const TIFFTAG_ARTIST=315

s="Example Artist"
call t.SetFieldString TIFFTAG_ARTIST,s

t.Close
MsgBox "Ok"
f.Launch
end if
end if

Please look for Tag values in the tiff specification.
Returns true on success.
Please make sure to use the correct setter depending on data type associated with the tag.
You have to pass in the string with the correct encoding.

Some examples using this method:

TiffPictureMBS.SetImageIndex(index as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the current image index and reads the new image.
Example
dim t as TiffPictureMBS // your tiff picture

if t.SetImageIndex(1) then
Canvas1.Backdrop=t.pict
end if

Reads automatically a RGB picture for you, so the pict property is filled on success.
Returns true on success.
Index is zero based.

See also:

TiffPictureMBS.SetImageIndex(index as Integer, HeaderOnly as boolean) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 4.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the current image index.

If HeaderOnly is false the current picture is read into the pict&mask properties.
Returns true on success.

See also:

TiffPictureMBS.SetXMP(ProfileData as String) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 7.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Sets the xmp metadata package for this tiff file.

Returns true on success and false on failure.

TiffPictureMBS.VStripSize(nrows as UInt32) as UInt64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 13.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns the number of bytes in a strip with nrows rows of data.

TiffPictureMBS.VTileSize(nrows as UInt32) as UInt64

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 13.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns the number of bytes in a row-aligned tile with nrows of data.

TiffPictureMBS.WriteBW as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 5.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Write a black & white image.
Example
dim p as Picture
dim f as FolderItem
dim t as TiffPictureMBS

p=New Picture(100,100,32)
p.Graphics.ForeColor=rgb(0,0,0)
p.Graphics.FillOval 0,0,100,100

f=SpecialFolder.Desktop.Child("test.tif")

t=new TiffPictureMBS

if t.Create(f) then
t.Pict=p
if t.WriteBW then
MsgBox "ok"
end if
end if

Backdrop=p

Uses the pictures in the pict property to write a picture.
Currently masks are not supported.

The following settings are made before the image data is written:
PlanarConfig = PLANARCONFIG_CONTIG
Photometric = PHOTOMETRIC_MINISBLACK
BitsPerSample = 1
SamplesPerPixel = 1
FillOrder = FILLORDER_MSB2LSB
VerticalResolution = 72
HorizontalResolution = 72
Orientation = ORIENTATION_TOPLEFT
ResolutionUnit = RESUNIT_INCH
Compression = COMPRESSION_NONE

You may change settings before or later. For example if you set Compression before it should be used for writing image data to the file.
Returns true on success.

This method uses the YieldTicks property and may yield time to other threads.

Some examples using this method:

TiffPictureMBS.WriteEncodedStrip(strip as UInt32, data as Memoryblock, size as Integer = 0) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 13.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Compress and write a strip of data to an open TIFF file.

Compress size bytes of raw data from buf and write the result to the specified strip; replacing any previously written data. Note that the value of strip is a ‘‘raw strip number.'' That is, the caller must take into account whether or not the data are organized in separate planes (PlanarConfiguration=2).

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with BitsPerSample greater than 8.

The strip number must be valid according to the current settings of the ImageLength and RowsPerStrip tags. An image may be dynamically grown by increasing the value of ImageLength prior to each call to WriteEncodedStrip.

Returns −1 is returned if an error was encountered. Otherwise, the value of size is returned.
If size is zero, we use the size of memoryblock.

TiffPictureMBS.WriteEncodedTile(tile as UInt32, data as Memoryblock, size as Integer = 0) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 13.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Compress and write a tile of data to an open TIFF file.

Compress size bytes of raw data from buf and append the result to the end of the specified tile. Note that the value of tile is a "raw tile number". That is, the caller must take into account whether or not the data are organized in separate places (PlanarConfiguration=2). ComputeTile automatically does this when converting an (x,y,z,sample) coordinate quadruple to a tile number.

The library writes encoded data using the native machine byte order. Correctly implemented TIFF readers are expected to do any necessary byte-swapping to correctly process image data with BitsPerSample greater than 8.

Returns −1 is returned if an error was encountered. Otherwise, the value of size is returned.

If size is zero, we use the size of memoryblock.

TiffPictureMBS.WriteGray as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 7.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Write a grayscale image with 256 colors.
Example
dim t as TiffPictureMBS
dim f as FolderItem

f=SpecialFolder.Desktop.Child("test.tif")

t=new TiffPictureMBS
if t.Create(f) then
t.Pict=LogoMBS(500)
call t.WriteGray
t.Close
end if

Uses the pictures in the pict property to write a picture.
Currently masks are not supported.

The following settings are made before the image data is written:
PlanarConfig = PLANARCONFIG_CONTIG
Photometric = PHOTOMETRIC_MINISBLACK
BitsPerSample = 8
SamplesPerPixel = 1
FillOrder = FILLORDER_MSB2LSB
VerticalResolution = 72
HorizontalResolution = 72
Orientation = ORIENTATION_TOPLEFT
ResolutionUnit = RESUNIT_INCH
Compression = COMPRESSION_NONE

You may change settings before or later. For example if you set Compression before it should be used for writing image data to the file.
Returns true on success.

This method uses the YieldTicks property and may yield time to other threads.
Version 13.1 of our plugins writes a 16 bit Gray image if you set BitsPerSample to 16 before calling this method.

Some examples using this method:

TiffPictureMBS.WriteRawStrip(strip as UInt32, data as Memoryblock, size as Integer = 0) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 13.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Write a strip of raw data to an open TIFF file.

Append size bytes of raw data to the specified strip.

The strip number must be valid according to the current settings of the ImageLength and RowsPerStrip tags. An image may be dynamically grown by increasing the value of ImageLength prior to each call to WriteRawStrip.

Returns -1 is returned if an error occurred. Otherwise, the value of size is returned.

If size is zero, we use the size of memoryblock.

TiffPictureMBS.WriteRawTile(tile as UInt32, data as Memoryblock, size as Integer = 0) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 13.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Write a tile of raw data to an open TIFF file

Append size bytes of raw data to the specified tile.
Returns −1 is returned if an error occurred. Otherwise, the value of size is returned.
If size is zero, we use the size of memoryblock.

TiffPictureMBS.WriteRGB as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 4.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes a RGB image.
Example
dim m,p as Picture
dim f as FolderItem
dim t as TiffPictureMBS
dim g as Graphics

p=New Picture(100,100,32)
m=New Picture(100,100,32)

p.Graphics.ForeColor=Rgb(0,255,0) // fill green
p.Graphics.Fillrect 0,0,100,100

p.Graphics.ForeColor=Rgb(255,0,0) // fill red
p.Graphics.FillOval 0,0,100,100

m.Graphics.ForeColor=Rgb(0,0,0) // fill black (invisible so green not seen)
m.Graphics.Fillrect 0,0,100,100

m.Graphics.ForeColor=Rgb(255,255,255) // fill white (Visible)
m.Graphics.FillOval 0,0,100,100

f=SpecialFolder.Desktop.Child("test.tif")

t=new TiffPictureMBS
t.Pict=p
t.Mask=m

if t.Create(f) then
if t.WriteRGB then
t.Close
MsgBox "Ok"
f.Launch
end if
end if

Uses the pictures in the mask and pict properties to write a picture.
If mask is set, the picture is saved with an alpha channel.

The following settings are made before the image data is written:
PlanarConfig = PLANARCONFIG_CONTIG
Photometric = PHOTOMETRIC_RGB
BitsPerSample = 8
SamplesPerPixel = 3
FillOrder = FILLORDER_MSB2LSB
VerticalResolution = 72
HorizontalResolution = 72
Orientation = ORIENTATION_TOPLEFT
ResolutionUnit = RESUNIT_INCH
Compression = COMPRESSION_NONE

You may change settings before or later. For example if you set Compression before it should be used for writing image data to the file.
Returns true on success.

This method uses the YieldTicks property and may yield time to other threads.

Some examples using this method:

Previous items

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


The biggest plugin in space...