SAVING IMAGES IN TIF AND JPG FORMATS . . .
I am having some problems getting IMAGE-PRO 10.0.7 to save images the way that I want.
I am doing a SNAPSHOT of an image which contains some LINE PROFILE INFORMATION in an OVERLAY. The SNAPSHOT generates an image which is approximately 3000 x 2000. I am would like to save this image as TIF and as a JPG.
I recorded the CODE below and the files that resulted are exactly what I want. The TIF IMAGE was approximately 17 MB and the JPG FILE was approximately 1 MB.
I altered the CODE to accept a FILE NAME (with no extension).
When I call the MMBSaveDead CODE, the TIF FILE that is generated by this code is approximately 17 MB. The JPG FILE that is generated by this code is also approximately 17 MB so I don't think that IMAGE-PRO is responding to the CODE in the same was as it responds to the UI when the CODE was generated.
Q1 -- How does MMBSaveDead need to be altered to resolve this issue so that the JPG FILE is truly a JPG FILE?
Q1 -- Can MMBSaveDead be altered to save the image in a TIF FILE using LZW COMPRESSION?
In the past, I have been directed to use something like the code below to save an image in a TIF FILE,
'Save the active image in the appropriate TIF FILE ThisApplication.ActiveImage.File.Format = _ "tif" ThisApplication.ActiveImage.SaveAs _ ( _ TempNewImageFullName _ )
This works but I cannot track down the HELP FILE PAGE that tells me the options for the
and replacing "tif" with "jpg" results in an IMAGE-PRO CRASH.
Thank you in advance.
Public Function MMBSaveDead(MyImageFileName As String) Dim window1, image1, doc1 With Application.WindowCommands.Active(Nothing) .Run(window1) End With With Application.WindowCommands.Snap(Nothing) .Run(window1, image1) End With With Application.DocumentCommands.Activate(Nothing) .Run(image1, doc1) End With With Application.DocumentCommands.SaveAs(Nothing) .Filename = MyImageFileName & ".tif" .Run(image1) End With With Application.DocumentCommands.Activate(Nothing) .Run(doc1, doc1) End With With Application.DocumentCommands.SaveAs(Nothing) .Filename = MyImageFileName & ".jpg" .Run(image1) End With With Application.DocumentCommands.Activate(Nothing) .Run(doc1, doc1) End With End Function
I can reproduce your issue and it looks like once the image was saved to TIF, saving it second time with different extension, saves it also as TIF, but with different extension.
We will look into the issue, but for now you can use a simple workaround, just save to JPG format first and then to TIF, like this:
You can set the Compression property of File to use LZW.
Here is a sample macro that saves active image to files with LZW and no compression: