469,582 Members | 2,373 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,582 developers. It's quick & easy.

Reading JPEG image compression type

Hi,
I need to know the compression type of jpeg (jpg) files. I am using the
System.Drawing.Imaging and loading the file using an Image object. The
next thing i do, is to examine the propertyItems property of the object
which gives me an ID, a type and Value. I am able to check for an ID of
259 (259 is the compression id) for Tiff images and check the value
upper and lower significant bits of the value to see the compression.
But i don't know how these (id, type, value) map for a jpeg image. Any
ideas?
thanks,
Mars

*** Sent via Developersdex http://www.developersdex.com ***
Nov 4 '08 #1
6 7175
I don't know anything about your object wrapper,
but if you parse a JPG header you find the tag 259
(H103) in the IFD1 section used for the embedded
thumbnail. A value of 1 means no compression. 6
means JPG compression. I think there are also a
couple of other rarely used compression types, but
I'm not sure about that.
I don't know of any Compression tag for the main
image.
I need to know the compression type of jpeg (jpg) files. I am using the
System.Drawing.Imaging and loading the file using an Image object. The
next thing i do, is to examine the propertyItems property of the object
which gives me an ID, a type and Value. I am able to check for an ID of
259 (259 is the compression id) for Tiff images and check the value
upper and lower significant bits of the value to see the compression.
But i don't know how these (id, type, value) map for a jpeg image. Any
ideas?
thanks,
Mars

*** Sent via Developersdex http://www.developersdex.com ***

Nov 4 '08 #2
Victory wrote:
Hi,
I need to know the compression type of jpeg (jpg) files. I am using the
System.Drawing.Imaging and loading the file using an Image object. The
next thing i do, is to examine the propertyItems property of the object
which gives me an ID, a type and Value. I am able to check for an ID of
259 (259 is the compression id) for Tiff images and check the value
upper and lower significant bits of the value to see the compression.
But i don't know how these (id, type, value) map for a jpeg image. Any
ideas?
thanks,
Mars
A Tiff file can use different compressions, like LZW or JPEG. A JPEG
file only uses JPEG compression.

--
Göran Andersson
_____
http://www.guffa.com
Nov 5 '08 #3
Hi all,
May be a little more explanation is needed here: When reading TIFF, then
the propertyItems will have IDs defined based on the TIFF Standard
definition. Based on the TIFF specs, when ID is 259, the values
represent the type of compression. The compression values can be
CCITTFAX3, CCITTFAX4, No Compression, and so on (the compression can
even be JPG). However, i am reading a file with a JPG extension. This
is different than a JPG within a TIFF.
When reading a file with JPG extension, i need to know the IDs and
structure defined so that i can appropriately map the data into the
structure and find out the properties of the image. What i am interested
in is the compression type. With JPG there are two main categories,
Huffman and arithmetic encoding compression types. Please clarify if
your answers i did not understand. This can be best answered by the
Microsoft developer that wrote the Image object and all its classes.
thank you,
Mars

*** Sent via Developersdex http://www.developersdex.com ***
Nov 5 '08 #4
http://www.media.mit.edu/pia/Researc...view/exif.html

I don't know whether this will help, as you seem
to be using a wrapper object with no direct access
to the file header, and this link is for details about
the JPG file header itself. If you look at that link you'll see
that 259 is the EXIF tag number for Compression
type of an embedded thumbnail. Your object apparently
renders the tags as "PropertyItem" objects (or
properties?).


Nov 5 '08 #5
Mayayana,
Thank you for the link, your inputs got me thinking and they were
helpful,

I am using the VB.NET's Image object in System.Drawing....
So, i am not using a home brew wrapper. it is supposed to return the
tags when i call image.propertyItems. for a TIFF image, it returns all
of them because the idea of a property in the image control closely
resembles the one in the TIFF specification. However, with a JPG file,
the same function returns only one ID which is 20624 or 0X5090 which
corresponds to luminance. So, i figured i can't use the same method for
both of these file formats. The TIFF docs use ID of 259 to refere to
Compression just like in the JPEG documentation you sent me the link to.
However, the function does not work the same for both types of images.
This is perhaps due to the drastic difference that the two file formats
have with each other.
Mars

*** Sent via Developersdex http://www.developersdex.com ***
Nov 6 '08 #6
>
I am using the VB.NET's Image object in System.Drawing....
So, i am not using a home brew wrapper.
Yes. I just meant a wrapper object in the sense that
the .Net object is wrapping the file parsing, as opposed to
reading the header directly. My only experience is in
parsing the actual header. (Using VBScript and VB.
I'm not familiar with that .Net object.)

After I posted that other link I found another
with more detailed info.:
http://www.sno.phy.queensu.ca/~phil/...ames/EXIF.html

It looks like the info. at the first link was partial.
Apparently the 259 tag can be used for both the
image and the thumbnail, differentiated by whether
the tag is in the IFD0 or IFD1 section.
for a TIFF image, it returns all
of them because the idea of a property in the image control closely
resembles the one in the TIFF specification. However, with a JPG file,
the same function returns only one ID which is 20624 or 0X5090 which
corresponds to luminance. So, i figured i can't use the same method for
both of these file formats. The TIFF docs use ID of 259 to refere to
Compression just like in the JPEG documentation you sent me the link to.
However, the function does not work the same for both types of images.
Oh, well. I'm afraid I may have led you on a
bit of a wild goose chase, at least as concerns
the System.Drawing.Image object.
Nov 6 '08 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Albert Greinöcker | last post: by
3 posts views Thread by 246C57AE-40DD-4d6b-9E8D-B0F5757BB2A8 | last post: by
reply views Thread by Stu | last post: by
1 post views Thread by Etienne Desautels | last post: by
1 post views Thread by Smokey Grindel | last post: by
2 posts views Thread by =?Utf-8?B?bWNpbWFnaW5n?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.