Home Image-Pro Automation (Macros, Apps, Reports)

PNG IMAGE FILES are not opening after IMAGE is CALIBRATED and saved as TIF IMAGE FILE . . .

2017-06-22-164142

All --

I have some code which is working with a FOLDER holding multiple PNG IMAGE FILES.

The code can select and open any of the PNG IMAGES files in the FOLDER.

The code relies upon

button_OpenImage_Click
shown below.

The OpenImage Routine works fine until until one of the IMAGES is CALIBRATED and SAVED as a TIF IMAGE FILE.

Then the OpenImage will not work until I use the PREMIER UI to manually open a PNG image in PREMIER.

I hit a glitch related to IMAGE TYPES a while back and was told to use

        'Workaround to save JPG image to TIF file with calibration, switch to TIF writer
        ThisApplication.ActiveImage.File.Format = _
            "tif"

to resolve it.

I have tried inserting

                'Workaround to open PNG image after saving TIF file with calibration
                ThisApplication.ActiveImage.File.Format = _
                    "png"
but the problem persists.

Can someone please suggest a resolution?

Thanks.

-- Matt

*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-

    Private Sub button_OpenImage_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)

        'CLOSE ALL IMAGES with no prompt
        CloseAllForm.ClosingAllAction=CloseAllForm.CloseAllFormAction.actionNoAll
        ThisApplication.Windows.CloseAll()

        Try

                'Open the appropriate image
                Dim docList1 = New List(1)
                With Application.DocumentCommands.OpenImage(Nothing)
                    .Filenames = New String() _
                        { _
                        textBox_Folder.Text & "\" & _
                        comboBox_FileName.SelectedItem _
                        }
                    .Run(docList1)
                End With

                'Connect with the active image
                With Application.DocumentCommands.ActiveImage(Nothing)
                    .Run(ThisApplication.ActiveImage)
                End With

                'Trigger the TILE function to make this image as big as possible
                Application.MDICommands.TileVertically(Nothing).Run()

            Catch
            Finally
            End Try

        'Call the update dialog box routine
        Update_Dialog

    End Sub

Best Answer

  • Answer ✓
    Matt,

    My guess is that saving this TIFF file might change the current directory from where the PNG files are to somewhere else. Make sure to use the full path when loading the PNG files in your macro.

    Pierre

Answers

  • edited June 2017
    2017-06-22-174318 --

    Pierre --

    Thank you for your suggestion.

    Something in my PROJECT was changing
     textBox_Folder.Text
    and pointing OpenImage to the wrong folder.

    Sorry for the false alarm.

    Thanks again for your suggestion.

    -- Matt
Sign In or Register to comment.