Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Tue, 25 Mar 2008 13:06:03 -0700,    group: microsoft.public.platformsdk.gdi        back       


JPEG CONVERSION   
I am coverting JPEG picture format into BMP format, and vice versa.
I wonder if I can use conversion functions used by the windows so that I do 
not have to develop seperately. 
How do I get to access these function ?
JPEG to BMP, and BMP to JPEG.

Thanks,
SpottyTheDog
date: Tue, 25 Mar 2008 13:06:03 -0700   author:   ChangChiTheGraphics

Re: JPEG CONVERSION   
google for "independent jpeg group".

Ch.

"ChangChiTheGraphics"  
wrote in message 
news:B17BFD39-7F71-45C5-8892-4E20F4F7E4C2@microsoft.com...
>I am coverting JPEG picture format into BMP format, and vice versa.
> I wonder if I can use conversion functions used by the windows so 
> that I do
> not have to develop seperately.
> How do I get to access these function ?
> JPEG to BMP, and BMP to JPEG.
>
> Thanks,
> SpottyTheDog
>
date: Wed, 26 Mar 2008 14:18:59 +0100   author:   Christian Kaiser

Re: JPEG CONVERSION   
What language are you using?

Mark

-- 
Mark Salsbery
Microsoft MVP - Visual C++


"ChangChiTheGraphics"  wrote 
in message news:B17BFD39-7F71-45C5-8892-4E20F4F7E4C2@microsoft.com...
> I am coverting JPEG picture format into BMP format, and vice versa.
> I wonder if I can use conversion functions used by the windows so that I 
> do
> not have to develop seperately.
> How do I get to access these function ?
> JPEG to BMP, and BMP to JPEG.
>
> Thanks,
> SpottyTheDog
>
date: Wed, 26 Mar 2008 09:55:28 -0700   author:   Mark Salsbery [MVP] MarkSalsbery[MVP]@newsgroup.nospam

Re: JPEG CONVERSION   
Hi Mark,

I am using C language, and my platform is Windows XP, service pak 2.

Thanks Mark.
ChangChiTheGraphics

"Mark Salsbery [MVP]" wrote:

> What language are you using?
> 
> Mark
> 
> -- 
> Mark Salsbery
> Microsoft MVP - Visual C++
> 
> 
> "ChangChiTheGraphics"  wrote 
> in message news:B17BFD39-7F71-45C5-8892-4E20F4F7E4C2@microsoft.com...
> > I am coverting JPEG picture format into BMP format, and vice versa.
> > I wonder if I can use conversion functions used by the windows so that I 
> > do
> > not have to develop seperately.
> > How do I get to access these function ?
> > JPEG to BMP, and BMP to JPEG.
> >
> > Thanks,
> > SpottyTheDog
> >
date: Wed, 26 Mar 2008 11:17:02 -0700   author:   ChangChiTheGraphics

Re: JPEG CONVERSION   
Hi Mark, 

I am using C language, and my platform is Windows XP, service pak 2. 

But if necessary, I can use C++ language because I am compiling 
with Visual C++ 2008.

Thank you for your help,

ChangChiThe Graphics


"Mark Salsbery [MVP]" wrote:

> What language are you using?
> 
> Mark
> 
> -- 
> Mark Salsbery
> Microsoft MVP - Visual C++
> 
> 
> "ChangChiTheGraphics"  wrote 
> in message news:B17BFD39-7F71-45C5-8892-4E20F4F7E4C2@microsoft.com...
> > I am coverting JPEG picture format into BMP format, and vice versa.
> > I wonder if I can use conversion functions used by the windows so that I 
> > do
> > not have to develop seperately.
> > How do I get to access these function ?
> > JPEG to BMP, and BMP to JPEG.
> >
> > Thanks,
> > SpottyTheDog
> >
date: Fri, 28 Mar 2008 08:51:01 -0700   author:   ChangChiTheGraphics

Re: JPEG CONVERSION   
Sorry about the slow response!

GDI+ makes it easy, but its interface is C++.  I've heard there's a way to 
use it from C, but I have no experience using it that way.

If you can use C++, then you can do the conversion in 3 lines of code using 
the shared ATL/MFC CImage class.
If you want to use GDI+ directly, it takes more code...

Following is an example (all of this is wrapped nicely in the CImage class)

//-------------------------------------------------------------------------
// C++ sample using straight GDI+:

// Note: GetEncoderClsid() Taken from the GDI+ documentation :)

int GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
{
	UINT  num = 0;          // number of image encoders
	UINT  size = 0;         // size of the image encoder array in bytes

	ImageCodecInfo* pImageCodecInfo = NULL;

	GetImageEncodersSize(&num, &size);
	if(size == 0)
		return -1;  // Failure

	pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
	if(pImageCodecInfo == NULL)
		return -1;  // Failure

	GetImageEncoders(num, size, pImageCodecInfo);

	for(UINT j = 0; j < num; ++j)
	{
		if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )
		{
			*pClsid = pImageCodecInfo[j].Clsid;
			free(pImageCodecInfo);
			return j;  // Success
		}
	}

	free(pImageCodecInfo);
	return -1;  // Failure
}


// GDI+ - Convert JPEG to BMP
#pragma push_macro("new")
#undef new

	ULONG dwToken;
	Gdiplus::GdiplusStartupInput input;
	Gdiplus::GdiplusStartupOutput output;
	Gdiplus::Status status = Gdiplus::GdiplusStartup(&dwToken, &input, 
&output);
	if(status == Gdiplus::Ok)
	{
		Gdiplus::Bitmap *pSrcBitmap = new Gdiplus::Bitmap(L"e:\\test.jpg", FALSE);
		CLSID bmpClsid;
		GetEncoderClsid(L"image/bmp", &bmpClsid);
		pSrcBitmap->Save(L"e:\\test.bmp", &bmpClsid);
		delete pSrcBitmap;

		Gdiplus::GdiplusShutdown(dwToken);
	}

#pragma pop_macro("new")

//-------------------------------------------------------------------------


Mark

-- 
Mark Salsbery
Microsoft MVP - Visual C++





"ChangChiTheGraphics"  wrote 
in message news:690863A1-F7EA-41C2-94F4-FB259486E273@microsoft.com...
> Hi Mark,
>
> I am using C language, and my platform is Windows XP, service pak 2.
>
> But if necessary, I can use C++ language because I am compiling
> with Visual C++ 2008.
>
> Thank you for your help,
>
> ChangChiThe Graphics
>
>
> "Mark Salsbery [MVP]" wrote:
>
>> What language are you using?
>>
>> Mark
>>
>> -- 
>> Mark Salsbery
>> Microsoft MVP - Visual C++
>>
>>
>> "ChangChiTheGraphics"  
>> wrote
>> in message news:B17BFD39-7F71-45C5-8892-4E20F4F7E4C2@microsoft.com...
>> > I am coverting JPEG picture format into BMP format, and vice versa.
>> > I wonder if I can use conversion functions used by the windows so that 
>> > I
>> > do
>> > not have to develop seperately.
>> > How do I get to access these function ?
>> > JPEG to BMP, and BMP to JPEG.
>> >
>> > Thanks,
>> > SpottyTheDog
>> >
date: Mon, 31 Mar 2008 13:57:55 -0700   author:   Mark Salsbery [MVP] MarkSalsbery[MVP]@newsgroup.nospam

Re: JPEG CONVERSION   
On Mar 31, 9:57 pm, "Mark Salsbery [MVP]"
<MarkSalsbery[MVP]@newsgroup.nospam> wrote:
> GDI makes it easy, but its interface is C.  I've heard there's a way to
> use it from C, but I have no experience using it that way.

Of course you can call C methods, or implement a C interface, in
straight C.  Indeed the header files often include appropriate
declarations for that.  However what you're probably thinking about is
the GDI flat interface:

 http://msdn2.microsoft.com/en-us/library/ms533969

Richard.
http://www.rtrussell.co.uk/
To reply by email change 'news' to my forename.
date: Wed, 9 Apr 2008 14:01:34 -0700 (PDT)   author:   Richard Russell

Re: JPEG CONVERSION   
"Richard Russell"  wrote in message 
news:427de807-cf7d-4d30-ab78-b8e03e5f16d3@1g2000prf.googlegroups.com...
> On Mar 31, 9:57 pm, "Mark Salsbery [MVP]"
> <MarkSalsbery[MVP]@newsgroup.nospam> wrote:
>> GDI+ makes it easy, but its interface is C++. I've heard there's a way to
>> use it from C, but I have no experience using it that way.
>
> Of course you can call C++ methods, or implement a C++ interface, in
> straight C.  Indeed the header files often include appropriate
> declarations for that.  However what you're probably thinking about is
> the GDI+ flat interface:
>
> http://msdn2.microsoft.com/en-us/library/ms533969


How can you call C++ methods from C?  Static methods used as a callback with 
C calling convention?
C doesn't know anything about classes, the new operator, etc.

Anyway, thanks for the link - that's what I was referring to! :)

Mark

-- 
Mark Salsbery
Microsoft MVP - Visual C++


>
> Richard.
> http://www.rtrussell.co.uk/
> To reply by email change 'news' to my forename.
date: Thu, 10 Apr 2008 10:31:54 -0700   author:   Mark Salsbery [MVP] MarkSalsbery[MVP]@newsgroup.nospam

Re: JPEG CONVERSION   
On Apr 10, 6:31 pm, "Mark Salsbery [MVP]"
<MarkSalsbery[MVP]@newsgroup.nospam> wrote:
> How can you call C methods from C?

All you've got to do is call the appropriate entry point in the
Vtable, remembering to add the first parameter (which is hidden in C
).  I support drag-and-drop in a plain C application using that
technique.

Check out the declarations commented as /* C style interface */ in the
header files (for example oleidl.h).

Richard.
http://www.rtrussell.co.uk/
To reply by email change 'news' to my forename.
date: Thu, 10 Apr 2008 15:02:10 -0700 (PDT)   author:   Richard Russell

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us