Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

Previous items Next items

TiffPictureMBS.ImageCount as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 4.3 Yes Yes Yes Yes No
Function: Returns the number of images in the TIFF file.
Notes: Returns 0 on any error.

Feedback, Comments & Corrections

TiffPictureMBS.ImageIndex as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 4.3 Yes Yes Yes Yes No
Function: The current image index.
Notes: 0 based.

Feedback, Comments & Corrections

TiffPictureMBS.IsLastImage as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 4.3 Yes Yes Yes Yes No
Function: Whether the current picture is the last picture.
Notes: Useful if you walk through all pictures using NextImage.

Feedback, Comments & Corrections

TiffPictureMBS.MirrorVertical(output as TiffPictureMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 7.1 Yes Yes Yes Yes No
Function: Mirrors the current picture to another tiff object.
Notes:
You may be able to pass the current tiff file as the output one if you have it open for read and write.
Returns true on success and false on failure.
Works for any color depth or color mode.

Feedback, Comments & Corrections

TiffPictureMBS.NextImage as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 4.3 Yes Yes Yes Yes No
Function: Loads the next image in the TIFF file.
Notes: Returns true on success and false on any error.

See also:

Feedback, Comments & Corrections

TiffPictureMBS.NextImage(HeaderOnly as boolean) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 4.3 Yes Yes Yes Yes No
Function: Reads the next image.
Notes: If HeaderOnly is false the current picture is read into the pict&mask properties.

See also:

Feedback, Comments & Corrections

TiffPictureMBS.Open(file as folderitem) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 4.2 Yes Yes Yes Yes No
Function: Opens a tiff file for readonly access.
Notes:
You need to use the ReadRGB method or the Scanline property to get data from this file.
Returns true on success.

See also:

Feedback, Comments & Corrections

TiffPictureMBS.Open(file as folderitem, Mode as string) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 5.3 Yes Yes Yes Yes No
Function: Opens a tiff file for readonly access.
Example:
dim file as folderitem = SpecialFolder.desktop.child("test.tif")
dim st as new MyTiff

// open for appending
if not st.Open(file,"r+") then
MsgBox "Open Tiff failed!"
else
// change one setting
st.Copyright = "Hello World"

// and save
call st.SaveImage
st.Close
end if
Notes:
Same as the other Open method, but you can pass a mode string to the library.

The open mode parameter can include the following flags in addition to the "r" (Read), "w" (Write), and "a" (Append) flags. Note however that option flags must follow the read-write-append specification.

lWhen creating a new file force information be written with Little-Endian byte order (but see below). By default the library will create new files using the native CPU byte order.
bWhen creating a new file force information be written with Big-Endian byte order (but see below). By default the library will create new files using the native CPU byte order.
LForce image data that is read or written to be treated with bits filled from Least Significant Bit (LSB) to Most Significant Bit (MSB). Note that this is the opposite to the way the library has worked from its inception.
BForce image data that is read or written to be treated with bits filled from Most Significant Bit (MSB) to Least Significant Bit (LSB); this is the default.
HForce image data that is read or written to be treated with bits filled in the same order as the native CPU.
MEnable the use of memory-mapped files for images opened read-only. If the underlying system does not support memory-mapped files or if the specific image being opened cannot be memory-mapped then the library will fallback to using the normal system interface for reading information. By default the library will attempt to use memory-mapped files.
mDisable the use of memory-mapped files.
CEnable the use of "strip chopping" when reading images that are comprised of a single strip or tile of uncompressed data. Strip chopping is a mechanism by which the library will automatically convert the single-strip image to multiple strips, each of which has about 8 Kilobytes of data. This facility can be useful in reducing the amount of memory used to read an image because the library normally reads each strip in its entirety. Strip chopping does however alter the apparent contents of the image because when an image is divided into multiple strips it looks as though the underlying file contains multiple separate strips. Finally, note that default handling of strip chopping is a compile-time configuration parameter. The default behaviour, for backwards compatibility, is to enable strip chopping.
cDisable the use of strip chopping when reading images.

See also:

Feedback, Comments & Corrections

TiffPictureMBS.OpenString(data as string) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 5.2 Yes Yes Yes Yes No
Function: Opens a tiff image located in a binary string.
Example:
Function TiffStringToPicture(data as string) As picture
dim t as MyTiffPictureMBS

t=new MyTiffPictureMBS

if t.OpenString(data) then
if t.ReadRGB then
return t.Pict
// you could add the mask here.
end if
end if

Return nil // failed
End Function
Notes:
Same as the Open() function, but memory based. You can now use functions like Scanline(), ReadSW() or ReadRGB() to get the picture data.

Returns true on success.
The Warning and Error events may show you reasons why it does not work.
The string you pass is saved in the data property of the class for later use.

You can and should use this function to write yourself a TiffStringToPicture function.

See also:

Feedback, Comments & Corrections

TiffPictureMBS.OpenString(data as string, Mode as string) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 5.3 Yes Yes Yes Yes No
Function: Opens a tiff image located in a binary string.
Notes: Same as the other OpenString method, but you can pass a mode string to the library.

See also:

Feedback, Comments & Corrections

TiffPictureMBS.RawStripSize(strip as UInt32) as UInt64
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 13.5 Yes Yes Yes Yes No
Function: Returns the number of bytes in a raw strip (i.e. not decoded).

Feedback, Comments & Corrections

TiffPictureMBS.ReadBW as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 4.3 Yes Yes Yes Yes No
Function: Reads the current picture in BW mode.
Example:
dim f as FolderItem
dim p as Picture
dim t as TiffPictureMBS

f=SpecialFolder.Desktop.Child("Multipage fax.tif")
t=f.OpenAsTiffMBS(true)

if t.ReadBW then
title=str(t.ImageCount)

p=t.pict
Title=str(p.Depth)
Canvas1.Backdrop=p
end if
Notes:
Returns true on success and false on any error.
Only if the current picture is a 1bit black&white picture, a new picture is created in the pict property and the data is copied inside.

Data in the TIFF file must be in 1 bit BW mode. Else use ReadRGB which does a lot of converting.

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

See also:

Feedback, Comments & Corrections

TiffPictureMBS.ReadBW(left as Integer, top as Integer, width as Integer, height as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 8.2 Yes Yes Yes Yes No
Function: Reads the current picture in BW mode.
Example:
dim f as FolderItem
dim p as Picture
dim t as TiffPictureMBS

f=SpecialFolder.Desktop.Child("Multipage fax.tif")
t=f.OpenAsTiffMBS(true)

if t.ReadBW(0,0,t.width/2,t.height/2) then
title=str(t.ImageCount)

p=t.pict
Title=str(p.Depth)
Canvas1.Backdrop=p
end if
Notes:
Returns true on success and false on any error.
Only if the current picture is a 1bit black&white picture, a new picture is created in the pict property and the data is copied inside.

Data in the TIFF file must be in 1 bit BW mode. Else use ReadRGB which does a lot of converting.

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

See also:

Feedback, Comments & Corrections

TiffPictureMBS.ReadEncodedStrip(strip as UInt32, byref data as Memoryblock) as UInt32
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 13.5 Yes Yes Yes Yes No
Function: Read and decode a strip of data from an open TIFF file.
Notes:
Read the specified strip of data and place up to size bytes of decompressed information in the (user supplied) data buffer.

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). To read a full strip of data the data buffer should typically be at least as large as the number returned by StripSize.
The library attempts to hide bit- and byte-ordering differences between the image and the native machine by converting data to the native machine order. Bit reversal is done if the FillOrder tag is opposite to the native machine bit order. 16- and 32-bit samples are automatically byte-swapped if the file was written with a byte order opposite to the native machine byte order,

Returns the actual number of bytes of data that were placed in buf is returned; ReadEncodedStrip returns -1 if an error was encountered.

Feedback, Comments & Corrections

TiffPictureMBS.ReadEncodedTile(tile as UInt32, byref data as Memoryblock) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 13.5 Yes Yes Yes Yes No
Function: Read and decode a tile of data from an open TIFF file.
Notes:
Read the specified tile of data and place up to size bytes of decompressed information in the (user supplied) data buffer.

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 planes (PlanarConfiguration=2). ComputeTile automatically does this when converting an (x,y,z,sample) coordinate quadruple to a tile number. To read a full tile of data the data buffer should be at least as large as the value returned by TileSize.

The library attempts to hide bit- and byte-ordering differences between the image and the native machine by converting data to the native machine order. Bit reversal is done if the FillOrder tag is opposite to the native machine bit order. 16- and 32-bit samples are automatically byte-swapped if the file was written with a byte order opposite to the native machine byte order,

Returns the actual number of bytes of data that were placed in buf is returned; ReadEncodedTile returns −1 if an error was encountered.

Feedback, Comments & Corrections

TiffPictureMBS.ReadPreviewBW as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 9.2 Yes Yes Yes Yes No
Function: Reads the current picture in BW mode as a preview.
Notes:
This method is faster than ReadBW, because it reads only every 8th line and every 8th pixel in each row. So the picture you get is much smaller, but may be enough for a preview.

Returns true on success and false on any error.
Only if the current picture is a 1bit black&white picture, a new picture is created in the pict property and the data is copied inside.

Data in the TIFF file must be in 1 bit BW mode. Else use ReadRGB which does a lot of converting.

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

See also:

Feedback, Comments & Corrections

TiffPictureMBS.ReadPreviewBW(left as Integer, top as Integer, width as Integer, height as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 9.2 Yes Yes Yes Yes No
Function: Reads the current picture in BW mode as a preview.
Notes:
This method is faster than ReadBW, because it reads only every 8th line and every 8th pixel in each row. So the picture you get is much smaller, but may be enough for a preview.

Returns true on success and false on any error.
Only if the current picture is a 1bit black&white picture, a new picture is created in the pict property and the data is copied inside.

Data in the TIFF file must be in 1 bit BW mode. Else use ReadRGB which does a lot of converting.

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

See also:

Feedback, Comments & Corrections

TiffPictureMBS.ReadPreviewRGB(ReduceFactor as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 9.2 Yes Yes Yes Yes No
Function: Reads a CMYK or RGB picture and stores it in the pict and name properties.
Notes:
This method is faster than ReadRGB, because it reads only every ReduceFactorth line and every ReduceFactorth pixel in each row. So the picture you get is much smaller, but may be enough for a preview.

Returns true on success.
ReadRGB does converting on the picture data if needed so you can read CMYK, RGB, BW and other image data using this function.

This function works with most Tiff formats, but has problems with some like 16 bit CMYK.

Feedback, Comments & Corrections

TiffPictureMBS.ReadRawStrip(strip as UInt32, byref data as Memoryblock) as UInt32
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 13.5 Yes Yes Yes Yes No
Function: Return the undecoded contents of a strip of data from an open TIFF file.
Notes:
Read the contents of the specified strip into the (user supplied) data buffer. Note that the value of strip is a "raw strip number". That is, the caller must take into account whether or not the data is organized in separate planes (PlanarConfiguration=2). To read a full strip of data the data buffer should typically be at least as large as the number returned by StripSize.

Returns the actual number of bytes of data that were placed in buf is returned; ReadEncodedStrip returns -1 if an error was encountered.

Feedback, Comments & Corrections

TiffPictureMBS.ReadRawTile(tile as UInt32, byref data as Memoryblock) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 13.5 Yes Yes Yes Yes No
Function: Return an undecoded tile of data from an open TIFF file.
Notes:

Read the contents of the specified tile into the (user supplied) data buffer. Note that the value of tile is a "raw tile number". That is, the caller must take into account whether or not the data is organized in separate planes (PlanarConfiguration=2). ComputeTile automatically does this when converting an (x,y,z,sample) coordinate quadruple to a tile number. To read a full tile of data the data buffer should typically be at least as large as the value returned by TileSize.

Returns the actual number of bytes of data that were placed in buf is returned; ReadEncodedTile returns −1 if an error was encountered.

Feedback, Comments & Corrections

TiffPictureMBS.ReadRGB as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 4.2 Yes Yes Yes Yes No
Function: Reads a CMYK or RGB picture and stores it in the pict and name properties.
Notes:
Returns true on success.
ReadRGB does converting on the picture data if needed so you can read CMYK, RGB, BW and other image data using this function.

This function works with most Tiff formats, but has problems with some like 16 bit CMYK.

See also:

Feedback, Comments & Corrections

TiffPictureMBS.ReadRGB(byref ErrorMessage as string, Dest as MemoryBlock = nil) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 9.0 Yes Yes Yes Yes No
Function: Reads the image into a memoryblock as RGB.
Notes:
The Scanline() array gives you the raw uncompressed data. But this method decodes the data into a RGBA image.

The Memoryblock has the size of 4*width*height. Each pixel has one byte for red, one byte for green, one byte for blue and one byte for alpha. If no alpha is in the file, all pixels have the same alpha of 255.

If the decompression fails the function returns nil. (e.g. out of memory).
If the decoding fails, you also get an error message.

This function works with most Tiff formats, but has problems with some like 16 bit CMYK.

If dest is not nil and big enough, the plugin will use it and return it on success. This can avoid additional memory allocations which can cost CPU time (especially to clear the bytes).

See also:

Feedback, Comments & Corrections

TiffPictureMBS.ReadRGBMemoryBegin(byref ErrorMessage as string) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 10.5 Yes Yes Yes Yes No
Function: Starts a RGBA reader for the given TIFF picture.
Notes:
Like ReadRGB, but with ReadRGBMemoryBegin, ReadRGBMemoryEnd and ReadRGBMemoryStep you can read the RGBA data in portions.

The Memoryblock returned by ReadRGBMemoryStep has the size of 4*width*height. Each pixel has one byte for red, one byte for green, one byte for blue and one byte for alpha. If no alpha is in the file, all pixels have the same alpha of 255.

If the decompression fails the function returns false. (e.g. out of memory).
If the decoding fails, you also get an error message.

This function works with most Tiff formats, but has problems with some like 16 bit CMYK.

Feedback, Comments & Corrections

TiffPictureMBS.ReadRGBMemoryEnd
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 10.5 Yes Yes Yes Yes No
Function: Cleans up the internal data structures created by ReadRGBMemoryBegin.

Feedback, Comments & Corrections

TiffPictureMBS.ReadRGBMemoryStep(x as Integer, y as Integer, width as Integer, height as Integer, Dest as MemoryBlock = nil) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 10.5 Yes Yes Yes Yes No
Function: Reads the image into a memoryblock as RGBA.
Example:
dim t as new TiffPictureMBS
dim f as FolderItem = SpecialFolder.Desktop.Child("test.tif")
dim e as string

if t.Open(f) then
if t.ReadRGBMemoryBegin(e) then

dim w as Integer = t.Width
dim h as Integer = t.Height

dim p as new PictureMBS(w, h, PictureMBS.ImageFormatRGB)

for y as Integer = 0 to h-1 step 100

dim m as MemoryBlock = t.ReadRGBMemoryStep(0, y, w, 100)

for i as Integer = 0 to 99
p.RowInFormat(i+y, PictureMBS.ImageFormatRGBA)=m
next

next

t.ReadRGBMemoryEnd
Backdrop = p.copypicture(0,0,1000,1000) // display a portion
end if

end if
Notes:
As you see in the example, you can use this method to easily read huge TIFF files into a PictureMBS object.

If the decompression fails the function returns nil. (e.g. out of memory).
Please make sure that the range in x and y, width and height is right.

If dest is not nil and big enough, the plugin will use it and return it on success. This can avoid additional memory allocations which can cost CPU time (especially to clear the bytes).

Feedback, Comments & Corrections

TiffPictureMBS.ReadWithLUT(ColorLookupTable() as color) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 9.8 Yes Yes Yes Yes No
Function: Reads the current picture with a Color Lookup Table.
Notes:
Returns true on success and false on any error.
Works with 8, 16 amd 32 bits per sample. And with 1 or 3 samples per pixels (Gray or RGB). The lookup table has 256 entries for 8 bit and 65536 entries for 16/32 bit.
This method uses the YieldTicks property and may yield time to other threads.

See also:

Feedback, Comments & Corrections

TiffPictureMBS.ReadWithLUT(ColorLookupTable() as color, left as Integer, top as Integer, width as Integer, height as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 9.8 Yes Yes Yes Yes No
Function: Reads the current picture with a Color Lookup Table.
Notes:
Returns true on success and false on any error.
Works with 8, 16 amd 32 bits per sample. And with 1 or 3 samples per pixels (Gray or RGB). The lookup table has 256 entries for 8 bit and 65536 entries for 16/32 bit.
This method uses the YieldTicks property and may yield time to other threads.

See also:

Feedback, Comments & Corrections

TiffPictureMBS.RewriteDirectory as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 8.7 Yes Yes Yes Yes No
Function: Writes existing picture and header information to file replacing the old data.
Notes:
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 SaveImage.

Feedback, Comments & Corrections

TiffPictureMBS.SaveImage as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method TIFF MBS Images Plugin 7.4 Yes Yes Yes Yes No
Function: Writes existing picture and header information to file replacing the old data.
Notes:
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.

Feedback, Comments & Corrections

TiffPictureMBS.Scanline(index as Integer, sample as Integer = 0) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property TIFF MBS Images Plugin 4.2 Yes Yes Yes Yes No
Function: An image scanline.
Notes:
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:

Feedback, Comments & Corrections

Previous items Next items

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




Links
MBS Xojo Plugins