Home Image-Pro General Discussions

How to change image DPI

Image-Pro Premier doesn’t expose UI to change the image DPI, however it is possible at the low level or with the following macro:
Public Sub SetActiveImageDPI
    Dim i As Integer, s As String

    If ThisApplication.ActiveImage IsNot Nothing Then
        With ThisApplication.ActiveImage
            i = .DotsPerInchX
            s = InputBox("Enter new DPI value:", "Set DPI", i.ToString)
            If Not String.IsNullOrEmpty(s) Then
                If Integer.TryParse(s, i) AndAlso i > 0 Then
                    .DotsPerInchX = i
                    .DotsPerInchY = i
                Else
                    MsgBox("Invalid DPI value!")
                End If
            End If
        End With
    End If
End Sub
Sign In or Register to comment.