TiffPictureMBS

I create a picture (kp) and set the dpi to 300 in Xojo code.
If I save it as a PNG, its correct.

ff is a folderitem.

If I save it with TiffPictureMBS as a TIFF file, I end up with the right number of pixels, but the image is 72dpi and thus way too large when printed by people who have no interest in being told how big it needs to be.
I get the same result when I use GMImageMBS methods

This is my TiffPictureMBS code:

 Dim t As New TiffPictureMBS
      t.Pict = kp
      t.Copyright = szCopyRite
      t.DocumentName = szTitle

      t.HorizontalResolution = 300  //issue occurs whether these lines are present or not
      t.VerticalResolution = 300
      t.ResolutionUnit = t.kResUnitInch

      If t.Create(ff) Then
        If t.WriteRGB Then
          t.Close
          // ok
        Else
          Break
        End If
      Else
        Break
      End If

Oddly, if I use this method, I get the right dpi, (but no access to other TIFF properties)
(Q: Why doesn’t Xojo use this to save in TIFF format?)

      dim bs as BinaryStream
      bs = BinaryStream.Create(ff,true)
      bs.Write(kp.GetData(Picture.FormatTIFF))
      bs.Close

Okay, seems I fixed it by moving create up.

Dim ff As FolderItem = SpecialFolder.Desktop.Child("test.tif")

Dim t As New TiffPictureMBS
If t.Create(ff) Then
  t.Pict = New Picture(200,200)
  t.Copyright = "test"
  t.DocumentName = "test"
  
  t.HorizontalResolution = 300  //issue occurs whether these lines are present or not
  t.VerticalResolution = 300
  t.ResolutionUnit = t.kResUnitInch
  
  If t.WriteRGB Then
    t.Close
    // ok
  Else
    Break
  End If
Else
  Break
End If

all the properties can only be set if you have a Tiff document open.

Thanks. I’ll give that a try.