Search code examples
xcodemacoscocoaikimagebrowserview

Reduce size of images in cocoa application


I have some 1000 images in my project,total size of the images is around 400MB. I am using this images to display thumbnail representation on MAc.

After building xcode,My Application build size is 410MB.I am using NSImage imageNamed api to access this image.

Is it possible to reduce the build size by reducing image size using cocoa.

Any suggestions would be appreciated.


Solution

  • If you build 400 MB of images into your application, then the total size of your application will be slightly more than 400 MB.

    There are three solutions:

    • Bundle fewer images.
    • Make them smaller (whether by compression or by reducing resolution/pixel size).
    • If possible, replace raster images (PNG, JPEG, TIFF) with vector images in PDF format.

    (Do note that simply wrapping a raster image in a PDF does not count; to reduce your file size, you must vectorize it.)

    You can also combine options 1 and 3 and replace bundled images with drawing code in your application (e.g., custom views). If you use Opacity to create the images, you can have it generate the code for you.