Re: Image format conversion
Yes, you can use GDI+ or other third party image libraries. Also, take a look at the articles at http://www.codeguru.com/Cpp/G-M/bitmap/. Some of them explain how to save to other formats.
Re: Image format conversion
You can do it with Image Class (GDI+).
/EDIT: Marc was faster :D
Cheers
Re: Image format conversion
Any other methos other than GDI
to convert a dib image to gif,jpg,tif
thank u
venrag
Re: Image format conversion
Quote:
Originally Posted by venrag
Any other methos other than GDI
to convert a dib image to gif,jpg,tif
thank u
venrag
Why? What do you have against GDI ? :D
Cheers
Re: Image format conversion
I don't have any thing against GDI+.
I have a image which is scanned from the scanner and put in the View.
This image is in the format of dib.
I convert it in to bmp and save it in the disc.
Suppose I want to save this dib image that is in the view in to
gif,jpg or tif ,I have to first convert in to bmp and save it in the disc and
then convert it to gif using GDI+ Image.
what i want to do is to convert the dib Image from the view directly to
gif,jpg ,tif.
For this I have asked whether we have any other method.
thank u
venrag
Re: Image format conversion
Have you checked the articles at http://www.codeguru.com/Cpp/G-M/bitmap/ like I said in my first reply?
For example, take a look at http://www.codeguru.com/cpp/g-m/bitm...cle.php/c4915/ to save bitmaps to JPG files.
NOTE: I would not recommend to save photos to GIF format because the GIF format only supports 256 colors and is not really suitable for photos.
Re: Image format conversion
Quote:
Originally Posted by venrag
I don't have any thing against GDI+.
I have a image which is scanned from the scanner and put in the View.
This image is in the format of dib.
I convert it in to bmp and save it in the disc.
Suppose I want to save this dib image that is in the view in to
gif,jpg or tif ,I have to first convert in to bmp and save it in the disc and
then convert it to gif using GDI+ Image.
what i want to do is to convert the dib Image from the view directly to
gif,jpg ,tif.
For this I have asked whether we have any other method.
thank u
venrag
You don’t have to write to the disc you can create Image from stream ( Image::FromStream() ).
Cheers
Re: Image format conversion
I have used the stream function.
Iam passing the
Code:
CWnd *pwnd=AfxGetMainWnd();
HWND hwnd =pwnd->GetSafeHwnd();
HDC hdc;
hdc=GetDC(hwnd);
Example_FromStream(hdc);
Inside Example_FromStream(hdc)
Graphics graphics(hdc);
Image* pImage1 = NULL;
Image* pImage2 = NULL;
IStorage* pIStorage = NULL;
IStream* pIStream1 = NULL;
IStream* pIStream2 = NULL;
HRESULT hr;
Status stat;
// Open an existing compound file, and get a pointer
// to its IStorage interface.
hr = StgOpenStorage(
L"CompoundFile.cmp",
NULL,
STGM_READ|STGM_SHARE_EXCLUSIVE,
NULL,
0,
&pIStorage);
if(FAILED(hr))
goto Exit;===>each time Iam getting failed
because hr=-ve value.
What is a CompoudFile.cmp
So I only I went for the filename method.
Canu helpme with Stream function
By the way I want to reduce the memory capacity of the image
so Iwant to convert it in to gif file
No problem with the reduction of the color.
thank u
Re: Image format conversion
Hi I got the conversion
from bmp to jpg
using GDI+ without saving the image to the disc.
I have not used Stream method .
Instead I got the idea from the below link
http://www.codeguru.com/cpp/g-m/gdi/...cle.php/c3661/
I have used CBitmap and Bitmap (GDI+) to get the handle of the
Image in the view.
"Thanks MarcG and GolanShahar"
I have tested the BMP with MSPAINT I am getting the jpeg format
memory size is correct.
When I convert to giff I am getting little bit difference.
Like in MSPAINT conversion 775kb -->35.5kb
In GDI+ --->55.5kb
I think this difference is because I have not reduced the color.
I have to find out that.
Thank u
venrag
Re: Image format conversion