Domanda

I've got an app that is generating thumbnails of images at runtime. But they're not in the optimized format that Xcode creates when images are added to a project. Is there a library or a function call I can use to convert these images?

È stato utile?

Soluzione

Instructions:

  1. Download DHowett (thanks, DHowett!) code from: https://github.com/DHowett/pincrush
  2. Unzip and rename to DHowett and place next to the XCode sample project I placed (https://www.box.com/s/7dfb3e6f430d98d933c2), and run...

If/When you build your own project from scratch, then do the following immediately after unzipping and BEFORE adding the folder to your project:

  1. Remove all makefile files from the folder
  2. Drag the folder to your project
  3. To overcome compiler warning "implicit declartion of function 'pincrush' is invalid in C99", changed project setting "C Language Dialect" to "GNU89"
  4. When building, you'll get an error "'png.h" file not found" - to fix it, add DHowett/libpng to the project's Header Search Paths
  5. open pincrush.c and comment out the "usage" and "main" functions (you don't need them, and the first causes compilation error, the second causes link errors)
  6. Add an external reference to crush... See below: extern void crush(const char *infilename, const char *outfilename);
  7. You can ignore the 8 compilation warnings of "Unused Entity Issue" caused by the "NEXT" macro
  8. You may need to remove the .git* files from the project (some annyoing warnings...)

    Enjoy, good luck!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top