Click here to Skip to main content
15,170,505 members
Articles / Desktop Programming / MFC
Posted 1 Feb 2003


91 bookmarked

Classes to read and write BMP, JPEG and JPEG 2000

Rate me:
Please Sign up or sign in to vote.
4.49/5 (58 votes)
1 Feb 20031 min read
Classes to read and write BMP, JPEG and JPEG 2000


This sample is an MFC application using the document/view architecture that can load, display and transcode files such as BMP (bitmap), JPEG, JPP (my private format using jpeg algorithm but with fewer overheads), jpc (jpeg 2000 code stream) and jp2 (jpeg 2000 format). It shows:

  1. Two classes, CMiniJpegEncoder and CMiniJpegDecoder, to support .jpp format. JPP is my private format using jpeg algorithm but with few overheads. These two classes are made in 2001 for one application that compress, transmit, and decompress PC screen image. Someone might ask, we have a jpeg format, so what is the JPP format for? The answer is, the jpeg format is a little complex and may have a 600-byte fileheader. So I made a 6-byte header format called .jpp. Also, no FF markers are needed for .jpp. With simple format of .jpp, you could clearly watch the jpeg algorithm, that would be useful to someone learning jpeg.
  2. Two classes, CTonyJpegEncoder and CTonyJpegDecoder, to support baseline jpeg format. I have no time to support other formats such as progressive + Huffman coding. It works for almost jpeg files, just with one-thousand-line codes! But if you want powerful functionality, please use IJG code. In this demo, you could choose the jpeg codec.
  3. To show the capability of JPEG-2000, by Jasper implementation.


If you have any question, or any comments, please contact me:


  • 1 Feb, 2003 - First revision.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Tony Lin
Web Developer
China China
Dr. Tony Lin, received his PhD degree from Peking University, Beijing, China, in 2001. His interests are in Pattern Recognition, Wavelets, and Programming.

Comments and Discussions

QuestionI use TonyJpegLib at Screen Capture Tool Pin
player.5-Jun-20 5:03
Memberplayer.5-Jun-20 5:03 
Question你能发给我一份技术规范文档吗 Pin
surenyufu14-May-13 15:59
Membersurenyufu14-May-13 15:59 
QuestionHow to build the program ? Pin
vhmau31-Aug-12 0:32
Membervhmau31-Aug-12 0:32 
AnswerRe: How to build the program ? Pin
surenyufu12-May-13 0:24
Membersurenyufu12-May-13 0:24 
GeneralMy vote of 5 Pin
hoummass10-Mar-11 13:20
Memberhoummass10-Mar-11 13:20 
QuestionWhere "J2kDll.dll" comes from? Pin
ZexinDing15-Sep-09 18:30
MemberZexinDing15-Sep-09 18:30 
QuestionHow to run the program Pin
fayefu26-Jun-09 17:01
Memberfayefu26-Jun-09 17:01 
Generalthank you Pin
futurejo5-Jan-09 20:32
Memberfuturejo5-Jan-09 20:32 
GeneralGreat Code, Crap Article! Pin
stevepqr24-Nov-08 1:35
Memberstevepqr24-Nov-08 1:35 
GeneralSimply Incredible Pin
software_chotmail27-Sep-08 1:09
Membersoftware_chotmail27-Sep-08 1:09 
QuestionHow to run the program Pin
Member 465780529-May-08 6:48
MemberMember 465780529-May-08 6:48 
GeneralJpg decoder Pin
NIkhilesh Reddy15-Apr-08 2:22
MemberNIkhilesh Reddy15-Apr-08 2:22 
GeneralThe Lib fails to decode some images Pin
Silvio Reis24-Jan-08 2:17
MemberSilvio Reis24-Jan-08 2:17 
QuestionImageTranscode Pin
dejavu13-Dec-07 21:31
Memberdejavu13-Dec-07 21:31 
Questionhow to reduce memory usage while loading background image in MFC Application? Pin
Khathar8-Aug-07 21:45
MemberKhathar8-Aug-07 21:45 
GeneralBad quality on Jpeg image Pin
davidlks11-Jul-07 23:35
Memberdavidlks11-Jul-07 23:35 
Questiontroubles with CminiJpegEncoder/decoder Pin
patkarbo20-Jun-07 9:41
Memberpatkarbo20-Jun-07 9:41 
Generaljpeg progressive Pin
edatul muliana20-May-07 22:06
Memberedatul muliana20-May-07 22:06 
GeneralMotion Pin
MrPMorris6-Mar-07 6:49
MemberMrPMorris6-Mar-07 6:49 
GeneralFixed marker problem Pin
LukeMulder2-Oct-06 3:30
MemberLukeMulder2-Oct-06 3:30 
General16 bits color cannot encoder Pin
mba66-Sep-06 1:35
Membermba66-Sep-06 1:35 
Generalcontrast tiff Pin
HoangManh3-Jun-06 17:08
MemberHoangManh3-Jun-06 17:08 
GeneralImageTranscode Pin
Adi DEDIC23-May-06 1:02
MemberAdi DEDIC23-May-06 1:02 
GeneralNeed JPEG Decoder Pin
kiran_siva13-Mar-06 20:00
Memberkiran_siva13-Mar-06 20:00 
GeneralRe: Need JPEG Decoder Pin
AghaKhan22-Apr-06 21:38
MemberAghaKhan22-Apr-06 21:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.