Using png for PictureMarkerSymbol

2240
2
Jump to solution
04-24-2013 09:14 PM
ModyBuchbinder
Esri Regular Contributor
By the docs you can create PicyureMarkerSymbol from bmp and emf files only.
Is there a way to create PictureMarkerSymbol from png file?

Thanks
Mody
0 Kudos
1 Solution

Accepted Solutions
AlexeySubbotin
New Contributor III
By the docs you can create PicyureMarkerSymbol from bmp and emf files only.
Is there a way to create PictureMarkerSymbol from png file?

Thanks
Mody


Hi, Mody!
Certainly you can create such a PictureMarkerSymbol. You should use the Bitmap class to load the image and then pass it to the Picture property of the IPictureMarkerSymbol object.

Code:
Bitmap bitmap=new Bitmap(image_path);
IPictureMarkerSymbol symbol=new PictureMarkerSymbolClass();
symbol.Picture=(stdole.IPictureDisp)ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDispFromBitmap(bitmap);

Similarly you can create the IPictureMarkerSymbol object from any image format supported by the Bitmap class, i.e. bmp, jpg, gif, exif, png, tiff. Even icons can be used for it (see the Bitmap.FromHicon method documentation).

View solution in original post

0 Kudos
2 Replies
AlexeySubbotin
New Contributor III
By the docs you can create PicyureMarkerSymbol from bmp and emf files only.
Is there a way to create PictureMarkerSymbol from png file?

Thanks
Mody


Hi, Mody!
Certainly you can create such a PictureMarkerSymbol. You should use the Bitmap class to load the image and then pass it to the Picture property of the IPictureMarkerSymbol object.

Code:
Bitmap bitmap=new Bitmap(image_path);
IPictureMarkerSymbol symbol=new PictureMarkerSymbolClass();
symbol.Picture=(stdole.IPictureDisp)ESRI.ArcGIS.ADF.COMSupport.OLE.GetIPictureDispFromBitmap(bitmap);

Similarly you can create the IPictureMarkerSymbol object from any image format supported by the Bitmap class, i.e. bmp, jpg, gif, exif, png, tiff. Even icons can be used for it (see the Bitmap.FromHicon method documentation).
0 Kudos
ModyBuchbinder
Esri Regular Contributor
Hi

I found a snippet CreatePictureMarkerSymbol that can get a png file.
The png format exists in the esriIPictureType eNum and works fine but the docs say only bmp and emf are supported (??)

Thanks
Mody
0 Kudos