Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Reducing the bit depth of a picture



I have an app, targeting OS 10.4+, which creates graphs and saves them as
either PNG or EPS.  The graphs are mathematical plots for which an image
depth of 8 bits is sufficient.

Creating the PNG is straightforward using

HIView --> CGImage --> QT --> PNG  (file size typically 28K)

The EPS is generated "manually" by the program and, by itself, gives
essentially perfect printouts with a filesize of 4K or 8K.  However, this
file requires a preview so that, when inserted into  MS Word, the user will
have something to look at (besides a rectangle).  I have always done this
using a PICT resource (#256) which Word recognizes.

The problem is that, if I use the sequence shown above to produce this PICT,
then the filesize increases to more than 600K (with display set to millions
of colors).  [Note: a document could contain dozens of such pictures.]

Currently, my solution is to create a bitmap context with 8 bits per
component and redraw the graph into that, then save the result as a picture
in the same manner as with PNG (filesize typically 128K).  However, this
seems to me to be a kludgy and roundabout procedure and I was wondering if I
might be missing something simpler.  Am I?

Is it possible, for instance, to make the HIView in my window have a
256-grayscale depth instead of inheriting millions of colors from the
screen?

Or could the CGImage be reduced in depth before being turned into a PICT
resource?

Or some other possibility?

Thanks in advance for any tips.

-- 
Mike McLaughlin

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.