/
Merge two TIFF files to one file

Merge two TIFF files to one file

VFP show from multi page tiff first page only. If you want extract some page to independently files, you can use class _XFRX_TIFF_WRITER.


This example is for XFRX 21.0.
Parameter tuAppendToFile is equal to parameter tuAppend in SetParams() method.

Append source file to end destination file

LOCAL m.lcSource, m.lcDestination, m.tuAppendToFile, m.loTIFF
m.lcSource="input.tiff"         && Input file
m.lcDestination="output_.tiff"  && Destination file
m.tuAppendToFile=.T.            && Append to end

SET PROCEDURE TO xfrx.prg
m.loTIFF=CREATEOBJECT("_XFRX_TIFF_WRITER")
?m.loTIFF.AppendPages(m.lcSource, m.lcDestination, m.tuAppendToFile)

Append source file begin first page of destination file

LOCAL m.lcSource, m.lcDestination, m.tuAppendToFile, m.loTIFF
m.lcSource="input.tiff"       && Input file
m.lcDestination="output.tiff" && Destination file
m.tuAppendToFile=1            && Append before first page

SET PROCEDURE TO xfrx.prg
m.loTIFF=CREATEOBJECT("_XFRX_TIFF_WRITER")
?m.loTIFF.AppendPages(m.lcSource, m.lcDestination, m.tuAppendToFile)

Replace third page in destination file

LOCAL m.lcSource, m.lcDestination, m.tuAppendToFile, m.loTIFF
m.lcSource="input.tiff"         && Input file
m.lcDestination="output_.tiff"  && Destination file
m.tuAppendToFile="R3"           && Replace third page

SET PROCEDURE TO xfrx.prg
m.loTIFF=CREATEOBJECT("_XFRX_TIFF_WRITER")
?m.loTIFF.AppendPages(m.lcSource, m.lcDestination, m.tuAppendToFile)