Link to home
Start Free TrialLog in
Avatar of binstar
binstar

asked on

Printing JPG bitmap

I need to print jpg files, the following
code works with bmp files but not jpg.  Thank you in advance.

LPCTSTR thebmp;
thebmp="c:\\nameit.jpg";
CBitmap bjg;
bjg.Attach(::LoadImage(NULL,thebmp,IMAGE_BITMAP,0,0,LR_LOADFROMFILE|LR_DEFAULTSIZE));
CPoint p;
p.x=100;
p.y=100;
CSize s;
s.cx=1700;
s.cy=1400;
pDC->DrawState(p,s,&bjg,NULL,NULL);
CRecordView::OnPrint(pDC, pInfo);
Avatar of bbousquet
bbousquet
Flag of Canada image

I'm pretty sure LoadImage works with BMP files only (well, icons and cursors too). Therefore if I'm not mistaken you'll have to get a hold of a picture conversion package (maybe Win32 can do something about that but I don't think LoadImage will load a JPG (or GIF, TIF, etc.) by itself.
Can you list down what header files have you included?

hongjun
Can you list down what header files have you included?

hongjun
Avatar of AlexVirochovsky
AlexVirochovsky

LoadImage don't work with jpg. You need
specific code for this. There are many
free source, see, for example,
            CImage Class for RAW, JIFF, GIF, JPG, PNG
http://www.visualc.com/default.asp?activex=&web=Download&lang=en&htype=&dlname=cimage.zip
            Nviewlib - Jpeg, GIF, BMP, RLE, DIB, PCX, TGA viewer DLL
http://home.att.net/~knishita/nviewlib.htm
 Or
            //See GIF/JPG files
http://www.vsce.com/src_code/faq_source_code.html
http://www.ijg.org
or PaintLib
www.paintlib.de , www.paintlib.com
Or
home.wxs.nl/~flvdberg
Or ...
ASKER CERTIFIED SOLUTION
Avatar of AlexVirochovsky
AlexVirochovsky

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial