Click here to Skip to main content
11,710,824 members (86,146 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ Multimedia JPEG
I wanna want to write a program which can rotate image, substract, add two image but I don't know how to read and write to JPEG file, and I do not know the format of JPEG file. Can someone help me?
Posted 27-Jun-13 5:46am
Edited 27-Jun-13 9:37am
CHill60103.9K
v3
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You don't need to know the format of the JPEG files for manipulating them. You may, for instance load (and manipulate) them using GDI+ (see, for instance "Rotating, Reflecting, and Skewing Images"[^]).
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

If GDI+ is not an option for you, then I would recommend to use one of the many libraries for converting image formats. For example this one:

CxImage[^]

That doesn't mean you should not have a look at the JPEG specification, as Harvey suggested in Solution 2. It just means that the JPEG standard is not trivial to understand implement and you might end up with a couple thousand line of C++ code. So for faster results you might want to use a good library.

A word about rotation. You can rotate a JPEG image by converting it into a bitmap, then rotate it (which is quite easy) and then re-encode it as a JPEG. This process is however not absolutely lossless, because JPEG is a lossy compression method. There is however a way of rotating a JPEG image without converting it into a bitmap, just by manipulating the internal data structures. Some libraries support lossles JPEG rotation. Just google for "jpegtran".
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

The file format for JPEG and how to build/manipulate one can be found here[^].
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 549
1 OriginalGriff 270
2 Peter Leow 134
3 Abhinav S 130
4 Richard MacCutchan 80
0 Abhinav S 60
1 Member 4653839 40
2 barneyman 35
3 Sergey Alexandrovich Kryukov 35
4 Member 11793820 35


Advertise | Privacy | Mobile
Web03 | 2.8.150819.1 | Last Updated 27 Jun 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100