Platforms to show: All Mac Windows Linux Cross-Platform

Back to TiffPictureMBS class.

TiffPictureMBS.SaveImage as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 7.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes existing picture and header information to file replacing the old data.

Returns true on success and false on any error.
As the data is added to the file and just the reference to the old data is deleted, the filesize will grow.

Calls TIFFReWriteDirectory internally. Same as RewriteDirectory.

TiffPictureMBS.Scanline(index as Integer, sample as Integer = 0) as memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
property TIFF MBS Images Plugin 4.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
An image scanline.

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.
(Read and Write computed property)

See also:

Some examples using this property:

TiffPictureMBS.Scanline(mem as Ptr, index as Integer, sample as Integer = 0) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 11.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads an image scanline in a memoryblock.

Returns false on any error.
Thee Memoryblock must be big enough. The BytesPerRow functions returns the number of bytes needed.
The first scanline has the index of 0.
This is the fastest way to read scanlines. You provide the memoryblock and you can reuse it for all calls to this method for one tiff.

See also:

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
Var p As New Picture(100,100,32)

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

Var t As New TiffPictureMBS
t.Pict = p

Var ProfileStream As BinaryStream = BinaryStream.Open(ProfileFile)
Var 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
Var t as TiffPictureMBS
Var 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
Var m,p as Picture
Var f as FolderItem
Var t as TiffPictureMBS
Var g as Graphics
Var 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
Var 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.

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


The biggest plugin in space...