PictureFormat.ImageFormat property (Publisher)
Returns a PbImageFormat constant that represents the image format of a picture as determined by the Microsoft Windows Graphics Device Interface (GDI+). Read-only.
Syntax
expression.ImageFormat
expression A variable that represents a PictureFormat object.
Return value
PbImageFormat
Remarks
The ImageFormat property applies to the original picture, rather than the placeholder picture, if there is one.
The ImageFormat property value can be one of the PbImageFormat constants declared in the Microsoft Publisher type library.
The ImageFormat property indicates the format of the picture after it has been imported into the Windows environment, rather than its original file format. If the picture's file format is not natively supported by the Windows operating system, the picture is converted to an analogous format that is natively supported. As a result, the pbImageFormatCMYKJPEG, pbImageFormatDIB, pbImageFormatEMF, pbImageFormatGIF, and pbImageFormatPICT constants will rarely, if ever, be returned.
Consult the following table for specific file format conversions.
File format | Constant returned |
---|---|
.bmp, .dib, .gif, .pict | pbImageFormatPNG |
.emf, .eps, .epfs | pbImageFormatWMF |
CMYK .jfif, .jpeg, .jpg | pbImageFormatJPEG |
Windows GDI+ is the portion of the Windows operating system and the Windows Server operating system that provides two-dimensional vector graphics, imaging, and typography.
Example
The following example prints a list of the .jpg and .jpeg images present in the active publication.
Dim pgLoop As Page
Dim shpLoop As Shape
For Each pgLoop In ActiveDocument.Pages
For Each shpLoop In pgLoop.Shapes
If shpLoop.Type = pbPicture Or shpLoop.Type = pbLinkedPicture Then
With shpLoop.PictureFormat
If .IsEmpty = msoFalse Then
If .ImageFormat = pbImageFormatJPEG Then
Debug.Print .Filename
End If
End If
End With
End If
Next shpLoop
Next pgLoop
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.