Marco,

Thanks for the exiftool pointer - very nice utility. There is indeed about 2KB of extra Header info in the Apple JPEG - mostly ICC profile info. There is also some subsampling differences as the Apple default is using 4:2:0 and Adobe is using 4:4:4 which may play a factor in quality.

I'll need to play with these a bit and see if I can find a common sense method of extracting the unneeded info. It's not a killer but with thousands of page views per day and web users expecting snappy page loads I'll throw a little effort into it. For those interested I here is the header info for the two files as regurgitated from exiftool - please comment if you see anything glaringly obvious that should be considered...


//============== ADOBE JPEG ==================//
---- ExifTool ----
ExifTool Version Number         : 7.81
---- File ----
File Name                       : 696-0.8-PS.jpg
Directory                       : .
File Size                       : 22 kB
File Modification Date/Time     : 2009:06:29 15:36:26-07:00
File Type                       : JPEG
MIME Type                       : image/jpeg
Image Width                     : 305
Image Height                    : 259
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)
---- JFIF ----
JFIF Version                    : 1.02
Resolution Unit                 : None
X Resolution                    : 100
Y Resolution                    : 100
---- Ducky ----
Quality                         : 80%
---- Adobe ----
DCT Encode Version              : 100
APP14 Flags 0 : [14], Encoded with Blend=1 downsampling
APP14 Flags 1                   : (none)
Color Transform                 : YCbCr
---- Composite ----
Image Size                      : 305x259


//============== APPLE JPEG ==================//
---- ExifTool ----
ExifTool Version Number         : 7.81
---- File ----
File Name                       : 696-0.8.jpg
Directory                       : .
File Size                       : 28 kB
File Modification Date/Time     : 2009:06:30 09:23:05-07:00
File Type                       : JPEG
MIME Type                       : image/jpeg
Exif Byte Order                 : Big-endian (Motorola, MM)
Image Width                     : 305
Image Height                    : 259
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
---- JFIF ----
JFIF Version                    : 1.01
Resolution Unit                 : None
X Resolution                    : 1
Y Resolution                    : 1
---- ICC-header ----
Profile CMM Type                : appl
Profile Version                 : 2.0.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 2009:05:15 09:32:58
Profile File Signature          : acsp
Primary Platform                : Apple Computer Inc.
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             :
Device Model                    :
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Perceptual
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : appl
Profile ID                      : d3aacba427aa3e36c6c6c0beb9e6dff7
---- ICC_Profile ----
Red Matrix Column               : 0.35953 0.21156 0.02415
Green Matrix Column             : 0.4537 0.70166 0.12245
Blue Matrix Column              : 0.15099 0.08719 0.67818
Media White Point               : 0.95047 1 1.0891
Chromatic Adaptation : 1.04788 0.02292 -0.0502 0.02957 0.99049 -0.01706 -0.00923 0.01508 0.75165 Red Tone Reproduction Curve : (Binary data 14 bytes, use -b option to extract) Green Tone Reproduction Curve : (Binary data 14 bytes, use -b option to extract) Blue Tone Reproduction Curve : (Binary data 14 bytes, use -b option to extract) Video Card Gamma : (Binary data 1554 bytes, use -b option to extract) Native Display Info : (Binary data 1598 bytes, use -b option to extract)
Profile Description             : Color LCD
Profile Description ML          : Color LCD
Make And Model : (Binary data 40 bytes, use -b option to extract)
Profile Copyright               : Copyright Apple, Inc., 2009
---- ExifIFD ----
Exif Image Width                : 305
Exif Image Height               : 259
---- Composite ----
Image Size                      : 305x259





On Jun 29, 2009, at 11:24 PM, Marco S Hyman wrote:

On Jun 29, 2009, at 4:12 PM, Chris Tracewell wrote:

The issue is that when using writeToFile my images have an extra 3 to 10 KB of size whether the image is really small or really big - ie 5KB or 300KB. I am suspecting that my XCode generated images are bigger for one of two reasons...

1) Adobe's JPEG compression is just plain better and unless I develop my own JPEG compression algorithm I am hosed. 2) My Objective-C created images contain extra file meta data / headers that are inflating the size a bit

Possible.  Grab a copy of exiftool and run it against a both a
photoshop image and one saved using your method.   It will tell
you what metadata is in each image.

I know that very old versions of photoshop would not save the
exif/iptc/whatever metadata which annoyed me no end as I find
the info quite worthwhile to have around.  On the other hand,
my "prepare images for web page" script makes a point of stripping
everything out of thumbnail images.

If you can't figure out how to do it in your app take a look
at jhead.   Your app could call "jhead -se -purejpg <filename>"
to do the job for you.

// marc


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to