Export to jpg

Jan 2, 2014 at 5:39 PM
I need export map to jpg. How is possible ?
Jan 3, 2014 at 6:53 AM
I didn't do it myself, but Joska seems did it. You might find the answer in this post

http://dotspatial.codeplex.com/discussions/394381

Oscar
Jan 6, 2014 at 6:43 AM
Hi,

here my code to save the map view to bitmap images.
            Dim ExportImgDialogFilterText As String = "Bitmap (*.BMP)|*.BMP|Enhanced Metafile (*.EMF)|*.EMF|Exchangeable (*.EXIF)|*.EXIF|Graphics Interchange (*.GIF)|*.GIF|Icon (*.ICO)|*.ICO|Icon (*. ICON)|*.ICON|Joint Photographic (*.JPEG)|*.JPEG|Joint Photographic (*.JPG)|*.JPG|Portable Network (*.PNG)|*.PNG|Tag Image (*.TIFF)|*.TIFF|Tag Image (*.TIF)|*.TIF|Metafile (*.WMF)|*.WMF"
            Dim dlg = New SaveFileDialog() With {.Filter = ExportImgDialogFilterText, .SupportMultiDottedExtensions = True & .DefaultExt = "bmp"}
            Dim MapBitmap As New Bitmap(Map1.MapFrame.ImageRectangle.Width, Map1.MapFrame.ImageRectangle.Height)
            Dim MapImage As Image
                 With dlg
                    .FilterIndex = 1
                    .OverwritePrompt = True
                    .Title = "Export Map"
                    .FileName = "Map_Export"
                    If dlg.ShowDialog(Me) = DialogResult.OK Then

                        Map1.DrawToBitmap(MapBitmap, Map1.ClientRectangle)
                        MapImage = MapBitmap

                        Select Case System.IO.Path.GetExtension(dlg.FileName).ToUpper


                            Case ".BMP"
                                MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Bmp)

                            Case ".EMF"

                                MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Emf)

                            Case ".EXIF"


                                MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Exif)

                            Case ".GIF"


                                MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Gif)

                            Case ".ICO", ".ICON"


                                MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Icon)

                            Case ".JPEG", ".JPG"


                                MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Jpeg)

                            Case ".PNG"


                                MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Png)

                            Case ".WMF"

                                MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Wmf)

                            Case ".TIFF", ".TIF"


                                MapImage.Save(.FileName, System.Drawing.Imaging.ImageFormat.Tiff)

                           
                            Case Else

                                MsgBox("Can not save file with that extension", MsgBoxStyle.OkOnly Or MsgBoxStyle.Information, "File Type Can Not Be Saved")

                        End Select

                    End If
                End With