On Mon, 26 Mar 2007 08:30:34, Michael McLaughlin <email@hidden> wrote:
> 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.
Sure, you can reduce the depth of the PICT to 8 bit or even to 1 bit
depth. Moreover, you can go even further and store the PICT as a
sequence of vectors, so the file size will be very small (few Ks
in your case). As mentioned, you can do the same with PDF, I'm just
not sure if Word can show previews from PDFs. If this is the standard
"EPS with preview" file you may also store the preview as the TIFF
chunk of the file (along with providing a simple header for the EPS),
in this case you'll be restricted to bitmapped image.
Mike
[Available for hire. Resume on request.]
_______________________________________________
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