Click here to Skip to main content
15,886,578 members
Articles / Desktop Programming / MFC
Article

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 2.2M   22.6K   92   74
Classes to read and write BMP, JPEG and JPEG 2000

Introduction

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.

Contact

If you have any question, or any comments, please contact me: lintong@cis.pku.edu.cn.

History

  • 1 Feb, 2003 - First revision.

License

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


Written By
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

 
GeneralCTonyJpegDecoder has a bug: does not work with pictures that have non-even dimensions! Pin
herculon27-Jan-06 2:29
herculon27-Jan-06 2:29 
GeneralDemo app encodes 24bpp BMPs only Pin
VYu25-Dec-05 20:41
VYu25-Dec-05 20:41 
Questionbmp Pin
bbiondo29-Aug-05 23:58
bbiondo29-Aug-05 23:58 
Questionhow about 24-bits CPU Pin
Mike03313-Jul-05 11:49
Mike03313-Jul-05 11:49 
GeneralExcellent article Pin
Duncan1234515-Feb-05 21:43
Duncan1234515-Feb-05 21:43 
Generalj2kdemo Pin
ImageResearcher30-Jul-04 23:41
ImageResearcher30-Jul-04 23:41 
GeneralAbout DCT coefficient Pin
Black:R31-Mar-04 1:16
Black:R31-Mar-04 1:16 
Generalnice code Pin
lonic22-Feb-04 19:15
lonic22-Feb-04 19:15 
Hi Tony,

nice code and example. I've got a question about the J2kDll.dll. Did you write it or is it from Jasper? I'd like to use it and want to implement a progress bar
to show the status of converting.

would be nice if you could send me answer to lonicmedia@gmx.de

best greetings from Berlin - Germany, Peter



Thanx for Help...
GeneralFile name error in ImageTranscode API Pin
Member 4746620-Feb-04 17:55
Member 4746620-Feb-04 17:55 
GeneralAA&N Pin
ptgeorge10-Jan-04 7:26
ptgeorge10-Jan-04 7:26 
GeneralJpeg 2000 Pin
Debasish Nath6-Jan-04 1:52
Debasish Nath6-Jan-04 1:52 
GeneralRe: Jpeg 2000 Pin
Anonymous22-Sep-05 0:54
Anonymous22-Sep-05 0:54 
GeneralJPEG2000 Pin
ligs200111-Nov-03 18:22
ligs200111-Nov-03 18:22 
GeneralRe: JPEG2000 Pin
Member 4746619-Feb-04 16:34
Member 4746619-Feb-04 16:34 
Questionjpeg2000? Pin
nicebruce4-Oct-03 17:17
nicebruce4-Oct-03 17:17 
AnswerRe: jpeg2000? Pin
Tony Lin6-Oct-03 3:04
Tony Lin6-Oct-03 3:04 
GeneralRe: jpeg2000? Pin
nicebruce8-Oct-03 16:16
nicebruce8-Oct-03 16:16 
QuestionHow to skip the error JPEG frame? Pin
James.Newman3-Aug-03 15:17
James.Newman3-Aug-03 15:17 
GeneralJPEG2000 decoding in memory Pin
otbfm26-Jun-03 4:21
sussotbfm26-Jun-03 4:21 
GeneralRe: JPEG2000 decoding in memory Pin
Tony Lin26-Jun-03 20:21
Tony Lin26-Jun-03 20:21 
GeneralJpeg-2000 Pin
yuli kaplunovsky19-Jun-03 23:16
yuli kaplunovsky19-Jun-03 23:16 
GeneralRe: Jpeg-2000 Pin
Tony Lin20-Jun-03 18:48
Tony Lin20-Jun-03 18:48 
GeneralA question Pin
JaneQian5-Jun-03 17:59
JaneQian5-Jun-03 17:59 
GeneralA question. Pin
JaneQian5-Jun-03 17:43
JaneQian5-Jun-03 17:43 
Generalthe quality of the out put jpeg file is poor Pin
Heway5-Jun-03 2:43
Heway5-Jun-03 2:43 

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.