Page 1 of 1

ImageConverter

Posted: 2014-01-04T05:17:57-07:00
by Gateway
First of all, sorry for bad English.
I'm using ImageMagick.NET library to create simple Multi-Image Converter. This is the problem:

Code: Select all

Value of type 'ImageMagick.MagickFormat' cannot be converted to 'System.Drawing.Imaging.ImageFormat'.
This is conversation code:

Code: Select all

If DataGridView1.Rows.Count > 0 And FolderBrowserDialog1.ShowDialog <> DialogResult.Cancel Then
            Dim j As Integer = 0
            Dim spath As String = ""
            Dim fpath As String = FolderBrowserDialog1.SelectedPath
            For j = 0 To DataGridView.Rows.Count - 1
                spath = fpath & "\" & DataGridView1.Item(0, j).Value.ToString.Substring(dgvFiles.Item(0, j).Value.ToString.LastIndexOf("\") + 1, (DataGridView1.Item(0, j).Value.ToString.LastIndexOf(".") - DataGridView1.Item(0, j).Value.ToString.LastIndexOf("\")) - 1)
                PictureBox1.Image = Image.FromFile(dgvFiles.Item(0, j).Value.ToString)
                ElseIf combobox1.SelectedItem = "Joint Photographic Experts Group (JPG)" Then
                 PictureBox1.Image.Save(spath & ".jpg", ImageMagick.MagickFormat.Jpg)
Can someone help me please with this problem?

Re: ImageConverter

Posted: 2014-01-04T06:06:22-07:00
by dlemstra
What are you trying to accomplish? If your 'PictureBox1.Image' is a Bitmap you should use the constructor of MagickImage that accepts a Bitmap.

Re: ImageConverter

Posted: 2014-01-04T09:24:15-07:00
by Gateway
dlemstra wrote:What are you trying to accomplish? If your 'PictureBox1.Image' is a Bitmap you should use the constructor of MagickImage that accepts a Bitmap.
Yes, I can do that and that is good idea, but how? :(

Re: ImageConverter

Posted: 2014-01-04T15:37:14-07:00
by dlemstra
If you don't know how to call a constructor you should first learn how to do this before using Magick.NET. I am sorry but I cannot help you with learning how to write programs.

Re: ImageConverter

Posted: 2014-04-27T23:53:28-07:00
by Farah_chew
Thanks for sharing this code, i was searching for this only.
thanks and regards
Farah