File sizes when NSImage's are included
File sizes when NSImage's are included
- Subject: File sizes when NSImage's are included
- From: Matthew Roberts <email@hidden>
- Date: Mon, 29 Dec 2003 09:04:09 -0500
I'm creating a gradebook program that lets me organize both my students'
grades and their personal info. One thing I've added recently is the
ability to store photos. It was easy enough, but now I'm wondering if I'm
doing it the right way.
OK: an editor window has an ImageView; user can drag image to ImageView,
which then sets an NSImage property in a corresponding user object.
When the file is saved, all the objects respond to encodeWithCoder:, which
then calls the same for the various standard objects (including the
NSImage).
All very standard--and it works great. However, either I've done something
wrong or this is an incredibly inefficient way to store images. I drag a
photo to the ImageView--just a 20k JPEG, say 400x300. When the file is
saved, the document file size has jumped by over 500K!
I've even now made it so that the image dragged into the ImageView is not
the image saved; instead, I use imageRep's to make sure it's stored as JPEG
(I would have thought it was already), add a goodly amount of compression,
and then make all images no taller than 200 pixels. And yet, I'm still
getting filesize increases of 500k for a simple 20k picture.
What am I doing wrong here? I'm content with the way the program works, but
I'd like to add every one's photos, and I've got over 90 students. I don't
want a simple data file that's 50Mb.
I'd appreciate any comments, thoughts, or ideas that you folks have.
_________________________________
Matthew Roberts (email@hidden)
Instructor, Dept. of Political Science
Calvin College
DeVos Communication Center 273C
1810 East Beltline Ave SE
Grand Rapids, MI 49546-5951
(616) 526-6727
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.