Converting BMP file to JPG file

D

David

Hello.

I need to convert BMP file to JPG file in CF.
For example I have some BMP file and I want to convert and save it to JPG
file.
How can I do this?

Thank you.
 
S

Sergey Bogdanov

You may consider PocketPC JpegLib [1] and also see article "How to save
a bitmap into jpeg file" [2]. Due to the fact that
WriteBitmapIntoJpegFile uses CString as a parameter you should write a
small wrapper over DLL with similiar function that will be received
wchar * instead of CString:

bool WriteBitmapIntoJpegFile(wchar *fileName, int nQuality, HBITMAP
hBitmap);

and then define P/Invoke for this method in your CF.NET application.

[1] http://www.pocketpcdn.com/articles/jpeglib.html
[2] http://www.pocketpcdn.com/articles/savejpeg.html

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
 
D

David

Do you know any method for C#?

Sergey Bogdanov said:
You may consider PocketPC JpegLib [1] and also see article "How to save a
bitmap into jpeg file" [2]. Due to the fact that WriteBitmapIntoJpegFile
uses CString as a parameter you should write a small wrapper over DLL with
similiar function that will be received wchar * instead of CString:

bool WriteBitmapIntoJpegFile(wchar *fileName, int nQuality, HBITMAP
hBitmap);

and then define P/Invoke for this method in your CF.NET application.

[1] http://www.pocketpcdn.com/articles/jpeglib.html
[2] http://www.pocketpcdn.com/articles/savejpeg.html

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
Hello.

I need to convert BMP file to JPG file in CF.
For example I have some BMP file and I want to convert and save it to JPG
file.
How can I do this?

Thank you.
 
S

Sergey Bogdanov

Sorry, no. AFAIK, there are only native libraries...

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
Do you know any method for C#?

You may consider PocketPC JpegLib [1] and also see article "How to save a
bitmap into jpeg file" [2]. Due to the fact that WriteBitmapIntoJpegFile
uses CString as a parameter you should write a small wrapper over DLL with
similiar function that will be received wchar * instead of CString:

bool WriteBitmapIntoJpegFile(wchar *fileName, int nQuality, HBITMAP
hBitmap);

and then define P/Invoke for this method in your CF.NET application.

[1] http://www.pocketpcdn.com/articles/jpeglib.html
[2] http://www.pocketpcdn.com/articles/savejpeg.html

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
Hello.

I need to convert BMP file to JPG file in CF.
For example I have some BMP file and I want to convert and save it to JPG
file.
How can I do this?

Thank you.
 
D

David

OK.
I'm little new in this technology can you show me demo of wrapper and send
me dll file of this library please (I'm using C# in CF)?

Sergey Bogdanov said:
Sorry, no. AFAIK, there are only native libraries...

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
Do you know any method for C#?

You may consider PocketPC JpegLib [1] and also see article "How to save a
bitmap into jpeg file" [2]. Due to the fact that WriteBitmapIntoJpegFile
uses CString as a parameter you should write a small wrapper over DLL
with similiar function that will be received wchar * instead of CString:

bool WriteBitmapIntoJpegFile(wchar *fileName, int nQuality, HBITMAP
hBitmap);

and then define P/Invoke for this method in your CF.NET application.

[1] http://www.pocketpcdn.com/articles/jpeglib.html
[2] http://www.pocketpcdn.com/articles/savejpeg.html

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com

David wrote:

Hello.

I need to convert BMP file to JPG file in CF.
For example I have some BMP file and I want to convert and save it to
JPG file.
How can I do this?

Thank you.
 
G

Guest

if you want to solve this problem in vb.net please try this following code
Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.ListBox1 = New System.Windows.Forms.ListBox
Me.Button1 = New System.Windows.Forms.Button
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
Me.SuspendLayout()
'
'PictureBox1
'
Me.PictureBox1.Location = New System.Drawing.Point(24, 24)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(120, 152)
Me.PictureBox1.TabIndex = 0
Me.PictureBox1.TabStop = False
'
'ListBox1
'
Me.ListBox1.Location = New System.Drawing.Point(216, 56)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.Size = New System.Drawing.Size(160, 342)
Me.ListBox1.TabIndex = 1
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(32, 232)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(96, 56)
Me.Button1.TabIndex = 2
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(568, 485)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.ListBox1)
Me.Controls.Add(Me.PictureBox1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim btmp As New Bitmap("C:\BMP IMAGE\170N001.bmp")
btmp.Save("C:\BMP IMAGE\170N001.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)
End Sub
End Class
Hope things will work smooth
-- Regards
Nasrul Saiyed
(e-mail address removed)


Sergey Bogdanov said:
You may consider PocketPC JpegLib [1] and also see article "How to save
a bitmap into jpeg file" [2]. Due to the fact that
WriteBitmapIntoJpegFile uses CString as a parameter you should write a
small wrapper over DLL with similiar function that will be received
wchar * instead of CString:

bool WriteBitmapIntoJpegFile(wchar *fileName, int nQuality, HBITMAP
hBitmap);

and then define P/Invoke for this method in your CF.NET application.

[1] http://www.pocketpcdn.com/articles/jpeglib.html
[2] http://www.pocketpcdn.com/articles/savejpeg.html

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
Hello.

I need to convert BMP file to JPG file in CF.
For example I have some BMP file and I want to convert and save it to JPG
file.
How can I do this?

Thank you.
 
S

Sergey Bogdanov

There is no Save method for CF1.0 and it will only work for CF2.0.

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com


Nasrul said:
if you want to solve this problem in vb.net please try this following code
Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.ListBox1 = New System.Windows.Forms.ListBox
Me.Button1 = New System.Windows.Forms.Button
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
Me.SuspendLayout()
'
'PictureBox1
'
Me.PictureBox1.Location = New System.Drawing.Point(24, 24)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(120, 152)
Me.PictureBox1.TabIndex = 0
Me.PictureBox1.TabStop = False
'
'ListBox1
'
Me.ListBox1.Location = New System.Drawing.Point(216, 56)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.Size = New System.Drawing.Size(160, 342)
Me.ListBox1.TabIndex = 1
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(32, 232)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(96, 56)
Me.Button1.TabIndex = 2
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(568, 485)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.ListBox1)
Me.Controls.Add(Me.PictureBox1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim btmp As New Bitmap("C:\BMP IMAGE\170N001.bmp")
btmp.Save("C:\BMP IMAGE\170N001.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)
End Sub
End Class
Hope things will work smooth
-- Regards
Nasrul Saiyed
(e-mail address removed)


:

You may consider PocketPC JpegLib [1] and also see article "How to save
a bitmap into jpeg file" [2]. Due to the fact that
WriteBitmapIntoJpegFile uses CString as a parameter you should write a
small wrapper over DLL with similiar function that will be received
wchar * instead of CString:

bool WriteBitmapIntoJpegFile(wchar *fileName, int nQuality, HBITMAP
hBitmap);

and then define P/Invoke for this method in your CF.NET application.

[1] http://www.pocketpcdn.com/articles/jpeglib.html
[2] http://www.pocketpcdn.com/articles/savejpeg.html

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
Hello.

I need to convert BMP file to JPG file in CF.
For example I have some BMP file and I want to convert and save it to JPG
file.
How can I do this?

Thank you.
 
B

Bob Nicholls

Sergey,

I would love to get hold of your jpeg code but your web site doesn't seem to
be working.

Bob

Sergey Bogdanov said:
There is no Save method for CF1.0 and it will only work for CF2.0.

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com


Nasrul said:
if you want to solve this problem in vb.net please try this following
code Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer. 'Do not modify
it using the code editor.
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents OpenFileDialog1 As
System.Windows.Forms.OpenFileDialog
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.ListBox1 = New System.Windows.Forms.ListBox
Me.Button1 = New System.Windows.Forms.Button
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
Me.SuspendLayout()
'
'PictureBox1
'
Me.PictureBox1.Location = New System.Drawing.Point(24, 24)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(120, 152)
Me.PictureBox1.TabIndex = 0
Me.PictureBox1.TabStop = False
'
'ListBox1
'
Me.ListBox1.Location = New System.Drawing.Point(216, 56)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.Size = New System.Drawing.Size(160, 342)
Me.ListBox1.TabIndex = 1
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(32, 232)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(96, 56)
Me.Button1.TabIndex = 2
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(568, 485)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.ListBox1)
Me.Controls.Add(Me.PictureBox1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim btmp As New Bitmap("C:\BMP IMAGE\170N001.bmp")
btmp.Save("C:\BMP IMAGE\170N001.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)
End Sub
End Class
Hope things will work smooth
-- Regards
Nasrul Saiyed
(e-mail address removed)


:

You may consider PocketPC JpegLib [1] and also see article "How to save a
bitmap into jpeg file" [2]. Due to the fact that WriteBitmapIntoJpegFile
uses CString as a parameter you should write a small wrapper over DLL
with similiar function that will be received wchar * instead of CString:

bool WriteBitmapIntoJpegFile(wchar *fileName, int nQuality, HBITMAP
hBitmap);

and then define P/Invoke for this method in your CF.NET application.

[1] http://www.pocketpcdn.com/articles/jpeglib.html
[2] http://www.pocketpcdn.com/articles/savejpeg.html

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com

David wrote:

Hello.

I need to convert BMP file to JPG file in CF.
For example I have some BMP file and I want to convert and save it to
JPG file.
How can I do this?

Thank you.
 
S

Sergey Bogdanov

Sorry, I'm moving to another webhost thus www.sergeybogdanov.com is
temporary unavailable. However if you want, you can send me email and
I'll attach JpegTest application as the reply.

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com


Bob said:
Sergey,

I would love to get hold of your jpeg code but your web site doesn't seem to
be working.

Bob

There is no Save method for CF1.0 and it will only work for CF2.0.

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com


Nasrul said:
if you want to solve this problem in vb.net please try this following
code Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer. 'Do not modify
it using the code editor.
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents OpenFileDialog1 As
System.Windows.Forms.OpenFileDialog
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.ListBox1 = New System.Windows.Forms.ListBox
Me.Button1 = New System.Windows.Forms.Button
Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
Me.SuspendLayout()
'
'PictureBox1
'
Me.PictureBox1.Location = New System.Drawing.Point(24, 24)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(120, 152)
Me.PictureBox1.TabIndex = 0
Me.PictureBox1.TabStop = False
'
'ListBox1
'
Me.ListBox1.Location = New System.Drawing.Point(216, 56)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.Size = New System.Drawing.Size(160, 342)
Me.ListBox1.TabIndex = 1
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(32, 232)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(96, 56)
Me.Button1.TabIndex = 2
Me.Button1.Text = "Button1"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(568, 485)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.ListBox1)
Me.Controls.Add(Me.PictureBox1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim btmp As New Bitmap("C:\BMP IMAGE\170N001.bmp")
btmp.Save("C:\BMP IMAGE\170N001.jpg",
System.Drawing.Imaging.ImageFormat.Jpeg)
End Sub
End Class
Hope things will work smooth
-- Regards
Nasrul Saiyed
(e-mail address removed)


:



You may consider PocketPC JpegLib [1] and also see article "How to save a
bitmap into jpeg file" [2]. Due to the fact that WriteBitmapIntoJpegFile
uses CString as a parameter you should write a small wrapper over DLL
with similiar function that will be received wchar * instead of CString:

bool WriteBitmapIntoJpegFile(wchar *fileName, int nQuality, HBITMAP
hBitmap);

and then define P/Invoke for this method in your CF.NET application.

[1] http://www.pocketpcdn.com/articles/jpeglib.html
[2] http://www.pocketpcdn.com/articles/savejpeg.html

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com

David wrote:


Hello.

I need to convert BMP file to JPG file in CF.
For example I have some BMP file and I want to convert and save it to
JPG file.
How can I do this?

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top