Platforms to show: All Mac Windows Linux Cross-Platform

Back to TiffPictureMBS class.

Next items

TiffPictureMBS.AddCustomTag(Tag as Integer, FieldReadCount as Integer, FieldWriteCount as Integer, FieldType as Integer, FieldBit as Integer, OkToChange as Integer, PassCount as Integer, FieldName as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Adds a custom tag.
Example
const TIFFTAG_ASCIITAG = 40666
const TIFFTAG_LONGTAG = 40667
const TIFFTAG_SHORTTAG = 40668
const TIFFTAG_RATIONALTAG = 40669
const TIFFTAG_FLOATTAG = 40670
const TIFFTAG_DOUBLETAG = 40671
const TIFFTAG_BYTE = 40672

const TIFFTAG_SOFTWARE=305

const TIFF_BYTE=1
const TIFF_ASCII=2
const TIFF_SHORT=3 // integer 16 bit signed
const TIFF_LONG=4 // integer 32 bit
const TIFF_FLOAT=11
const TIFF_DOUBLE=12

const FIELD_CUSTOM = 65

dim t as new TiffPictureMBS

// open tiff

if not t.AddCustomTag(TIFFTAG_ASCIITAG, -1, -1, TIFF_ASCII, FIELD_CUSTOM, 1, 0, "MyString") then
MsgBox "AddCustomTag failed1."
end if

See tiff documentation for details.

Some examples using this method:

TiffPictureMBS.AddImage as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 5.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Writes existing picture and header information to file and starts a new one.
Example
dim t as TiffPictureMBS
dim f as FolderItem
dim p as Picture

f=SpecialFolder.Desktop.Child("test.tif")
t=new TiffPictureMBS
if t.Create(f) then

p=New Picture(100,100,32)
p.Graphics.ForeColor=rgb(255,0,0)
p.Graphics.FillOval 0,0,100,100
t.Pict=p
if t.WriteRGB then
if t.AddImage then
p=New Picture(100,100,32)
p.Graphics.ForeColor=rgb(0,0,255)
p.Graphics.FillOval 0,0,100,100
t.Pict=p
if t.WriteRGB then
MsgBox "Written multi picture tiff."
end if
end if
end if
end if

Returns true on success and false on any error.

Calls TIFFWriteDirectory internally.

TiffPictureMBS.close

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 3.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Closes the Tiff handle.

In 5.1 and older the destructor.
In 5.2 and later only closes the tiff handle so you can still read the pictures, the output or input buffer.

TiffPictureMBS.CombinePictureWithMask as picture

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 6.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns a new picture which is created using the picture and it's mask.
Example
dim t as TiffPictureMBS
' ...
canvas1.backdrop=t.CombinePictureWithMask

TiffPictureMBS.Create(file as folderitem) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 4.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new empty tiff file.
Example
dim p as Picture
dim f as FolderItem
dim t as TiffPictureMBS

p=New Picture(100,100,32)

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

t=new TiffPictureMBS
t.Pict=p

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

Returns true on success.

See also:

TiffPictureMBS.Create(file as folderitem, endian as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 4.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new empty tiff file.
Example
Dim t As New TiffPictureMBS
t.Pict = LogoMBS(500)

// try with path
Dim f As FolderItem = SpecialFolder.Desktop.Child("test.tif")

If t.Create(f, 0) Then
If t.WriteRGB Then
t.Close

// open in viewer
f.Launch
End If
End If

Returns true on success.

Endian settings:
0Default (System)
1BigEndian (Mac)
2LittleEndian (Win)

See also:

TiffPictureMBS.Create(Path as String, endian as integer = 0) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 19.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new empty tiff file.
Example
Dim t As New TiffPictureMBS
t.Pict = LogoMBS(500)

// try with path
Dim f As FolderItem = SpecialFolder.Desktop.Child("test.tif")
dim p as string = f.NativePath

If t.Create(p) Then
If t.WriteRGB Then
t.Close

// open in viewer
f.Launch
End If
End If

Returns true on success.

Endian settings:
0Default (System)
1BigEndian (Mac)
2LittleEndian (Win)

See also:

TiffPictureMBS.CreateString(Size as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 5.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new string based tiff writer.
Example
Function PictureToTiffStringMBS(pic as picture) As string
dim t as TiffPictureMBS

t=new TiffPictureMBS
if t.CreateString(&h100000) then
t.Pict=pic
if t.WriteRGB then
t.Close
Return t.OutputBuffer
end if
end if
End Function

Same as the Create() function, but memory based. You can now use functions like Scanline(), WriteSW() or WriteRGB() to put the picture data.

Returns true on success.
The Warning and Error events may show you reasons why it does not work.

The size parameter you pass in is a guess for the initial size of the memory block used. If more data is written, the memory block is resized, but it is quite slow to resize a memoryblock, so make a good guess!

You can and should use this function to write yourself a PictureToTiffString function. The plugin can not well make such a function as there are thousands of possible parameters combination you may want to use. (compared to the JPEG library where you only have the compression level parameter.)

See also:

Some examples using this method:

TiffPictureMBS.CreateString(Size as Integer, Mode as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 5.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Creates a new string based tiff writer.

Same as the other CreateString method, but you can pass a mode string to the library.

mode="wb" for big endian and mode="wl" for little endian.

See also:

TiffPictureMBS.Flush as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 5.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Flush causes any pending writes for the specified file (including writes for the current directory) to be done.

In normal operation this call is never needed - the library automatically does any flushing required.

TiffPictureMBS.FlushData as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 5.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
FlushData flushes any pending image data for the specified file to be written out; directory-related data are not flushed.

In normal operation this call is never needed Å| the library automatically does any flushing required.

TiffPictureMBS.GetColorMap(byref red as memoryblock, byref green as memoryblock, byref 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
Queries 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.GetColorProfile as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 7.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns the color profile data stored in the tiff file.
Example
dim f as FolderItem
dim t as TiffPictureMBS
dim s as string
dim p as LCMS2ProfileMBS

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

t=f.OpenAsTiffMBS

s=t.GetColorProfile

p = LCMS2ProfileMBS.OpenProfileFromString(s)

MsgBox p.Name

Returns "" on any error.

Some examples using this method:

TiffPictureMBS.GetData(Tag as Integer) as string

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

TiffPictureMBS.GetField(Tag as Integer, mem as memoryblock) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 7.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads the value associated with the given tag id.

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.
The memoryblock you pass in must be big enough to hold whatever data the library stores there.

TiffPictureMBS.GetFieldByte(Tag as Integer, byref 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
Reads the value associated with the given tag id.

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.GetFieldCount(Tag as Integer, byref count as Integer, mem 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
Reads the value associated with the given tag id.
Example
'TIFF Tag ImageID
'
'IFD Image
'Code 32781 (hex 0x800D)
'Name ImageID
'Type ASCII
'Count N
'Default None
'Description
'
'OPI-related.
'
'ImageID is the full pathname of the original, high-resolution image, or any other identifying string that uniquely identifies the original image.
'
'The high-resolution image is not required to be in TIFF format. It can be in any format that an OPI Consumer wishes to support.

DIm tiffImport As TiffPictureMBS
Dim xx as string

tiffImport = New TiffPictureMBS
Call tiffImport.Open(SpecialFolder.Desktop.Child("test.tif"))

// the memoryblock is a storage for the data. In this case a pointer to the CString
dim m as MemoryBlock=NewMemoryBlock(4)
dim count as Integer

if tiffImport.GetFieldCount(32781, count, m) then
MsgBox str(count)
MsgBox m.Ptr(0).CString(0)
end if

tiffImport.close

This is the special version using memoryblock so you can use it for reading values with a count 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.GetFieldDefaultedByte(Tag as Integer, byref 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
Reads the value associated with the given tag id.

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

GetFieldDefaulted* is identical to GetField*, except that if a tag is not defined in the current directory and it has a default value, then the default value is returned.

TiffPictureMBS.GetFieldDefaultedDouble(Tag as Integer, byref 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
Reads the value associated with the given tag id.

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

GetFieldDefaulted* is identical to GetField*, except that if a tag is not defined in the current directory and it has a default value, then the default value is returned.

TiffPictureMBS.GetFieldDefaultedInteger(Tag as Integer, byref 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
Reads the value associated with the given tag id.

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

GetFieldDefaulted* is identical to GetField*, except that if a tag is not defined in the current directory and it has a default value, then the default value is returned.

TiffPictureMBS.GetFieldDefaultedShort(Tag as Integer, byref 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
Reads the value associated with the given tag id.

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

GetFieldDefaulted* is identical to GetField*, except that if a tag is not defined in the current directory and it has a default value, then the default value is returned.

TiffPictureMBS.GetFieldDefaultedSingle(Tag as Integer, byref 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
Reads the value associated with the given tag id.

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

GetFieldDefaulted* is identical to GetField*, except that if a tag is not defined in the current directory and it has a default value, then the default value is returned.

TiffPictureMBS.GetFieldDefaultedString(Tag as Integer, byref 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
Reads the value associated with the given tag id.
Example
dim t as TiffPictureMBS
dim f as FolderItem
dim s as string

f=SpecialFolder.Desktop.Child("ChristianSchmitz.tif")
t=f.OpenAsTiffMBS

const TIFFTAG_SOFTWARE=305

if t.GetFieldDefaultedString(TIFFTAG_SOFTWARE, s) then
MsgBox "TIFFTAG_SOFTWARE"+EndOfLine+s
end if

Please look for Tag values in the tiff specification.
Returns true on success. May return a default value.
Please make sure to use the correct setter depending on data type associated with the tag.
The string is returned with ascii encoding. You may need to define a different encoding is this is not correct.

GetFieldDefaulted* is identical to GetField*, except that if a tag is not defined in the current directory and it has a default value, then the default value is returned.

TiffPictureMBS.GetFieldDouble(Tag as Integer, byref 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
Reads the value associated with the given tag id.

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.GetFieldInteger(Tag as Integer, byref 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
Reads the value associated with the given tag id.

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.GetFieldMemory(Tag as Integer, byref ItemCount as Integer) as memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method TIFF MBS Images Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Reads the value associated with the given tag id.

This is the special version using memoryblock so you can use it for reading values with a count 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.

Some examples using this method:

TiffPictureMBS.GetFieldShort(Tag as Integer, byref 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
Reads the value associated with the given tag id.

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.GetFieldSingle(Tag as Integer, byref 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
Reads the value associated with the given tag id.

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.

Next items

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


The biggest plugin in space...