Page 1 of 1

Using GdPicture.NET in WPF application

Posted: Tue Jul 12, 2011 6:25 pm
by Loïc
Here an example that converts a GdPicture image to a BitmapSource object, and uses the JpegBitmapEncoder to subsequently save the BitmapSource to a jpegfile.

Feel free to post any comment, questions about the snippet or request for other scenario support.

Also, you can find a WPF application demo based on GdPicture8 that demonstrate how to use GdPictureImaging & GdViewer class in a WPF windows.

Code: Select all

        Dim oGdPictureImaging As New GdPicture.GdPictureImaging

        oGdPictureImaging.SetLicenseNumber("XXX") 'Please replace XXX by a valid license KEY
        Dim ImageID As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("")
        If ImageID <> 0 Then
            oGdPictureImaging.ConvertTo24BppRGB(ImageID)
            Dim MyBitmapSource As BitmapSource = System.Windows.Media.Imaging.BitmapSource.Create(oGdPictureImaging.GetWidth(ImageID), _
                                                                                                  oGdPictureImaging.GetHeight(ImageID), _
                                                                                                   oGdPictureImaging.GetHorizontalResolution(ImageID), _
                                                                                                   oGdPictureImaging.GetVerticalResolution(ImageID), _
                                                                                                   PixelFormats.Bgr24, _
                                                                                                   Nothing, _
                                                                                                   oGdPictureImaging.GetBits(ImageID), _
                                                                                                   oGdPictureImaging.GetStride(ImageID) * oGdPictureImaging.GetHeight(ImageID), _
                                                                                                   oGdPictureImaging.GetStride(ImageID))
            oGdPictureImaging.ReleaseGdPictureImage(ImageID)
            Dim MyEncoder As New JpegBitmapEncoder()
            MyEncoder.Frames.Add(BitmapFrame.Create(MyBitmapSource))
            Dim MyFileStream As New System.IO.FileStream("c:\test.jpg", System.IO.FileMode.Create)

            MyEncoder.Save(MyFileStream)
            MyFileStream.Close()

WPF Sample

Posted: Tue Jul 12, 2011 6:47 pm
by Loïc

Re: Using GdPicture.NET in WPF application

Posted: Mon Feb 13, 2012 3:40 pm
by matze
Hi,
the link for the demo doesn't work.

Re: Using GdPicture.NET in WPF application

Posted: Mon Feb 13, 2012 3:45 pm
by Loïc
Hello,

Fixed. Please try again.

Kind regards,

Loïc

Re: Using GdPicture.NET in WPF application

Posted: Thu Jan 31, 2019 4:51 pm
by Gabriela
Hello,

You can find WPF demo samples in the installation package of the toolkit under \\Samples\\WPF.

Re: Using GdPicture.NET in WPF application

Posted: Wed Aug 03, 2022 3:04 pm
by alphayash
was looking for this thread for a long time now :)
VidMate Cinevez technomantu

Re: Using GdPicture.NET in WPF application

Posted: Thu Dec 22, 2022 10:05 am
by golu121
I just Looking here :D :roll:
GBwhatsapp