|
|
#1 |
|
How to use libjpeg in xCode
I'm developing an iPhone application and I'm kind of new to everything. I'm working on Mountain Lion OS X 10.8 and using xCode v4.5. I need JPEG handling capabilities in my project and I want to use the libjpeg (http://www.ijg.org/) library. I have tried a few different approaches, but being a bit naive, I'm not really sure how to begin. After downloading packages I've made usual ./configure; make and make install. Right now I have (jconfig.h, jerror.h, jmorecfg.h, jpeglib.h) under (/usr/local/include) and (libjpeg.a, libjpeg.la) under (/usr/local/lib) but I have no idea how to link/use this in my xCode project.
Can anyone link me to a tutorial or give me a push in the right direction? If anyone successfully installed and used jpeg library please help.. |
|
|
|
0
|
|
|
#2 |
|
iOS can do various things with JPEG images without adding any libraries.
"JPEG handling capabilities" is too vague. Please describe what you want to accomplish using libjpeg, that can't be accomplished with existing iOS capabilities. If you don't know, then you should study UIImage and the underlying image-file handling, so you know what's possible without libjpeg. Your question is basically an XY problem: http://www.perlmonks.org/index.pl?node_id=542341 .. You want to do X, and you think Y is the best way of doing it. .. Instead of asking about X, you ask about Y. |
|
|
|
1
|
|
|
#3 | |
|
Quote:
Code:
Tagged Image File Format (TIFF) .tiff, .tif Joint Photographic Experts Group (JPEG) .jpg, .jpeg Graphic Interchange Format (GIF) .gif Portable Network Graphic (PNG) .png Windows Bitmap Format (DIB) .bmp, .BMPf Windows Icon Format .ico Windows Cursor .cur XWindow bitmap .xbm I recommend using PNG instead, because iOS does a crap job of loading JPGs, especially for Retina displays. You get a lot of banding. JPGs are lossy, and quality is lost when loading them. Special warning: Do not use JPG for GUI elements. Your app will look like crap under Retina. Always use PNG. |
||
|
|
1
|
|
|
#4 |
|
Using an open source library like libjpeg can be straightforward. Usually the hard part is building the library but you seem to have already done that. make install probably isn't useful. You're not interested in installing into /usr.
Make two folders in your project folder, one for the .a file and the other for the headers. Add the header folder to your project. Add the .a file to your project in the frameworks group. If you've built your library correctly that should be all that's required to use it. This also might be informative: http://www.imagemagick.org/download/iOS/ |
|
|
|
0
|
|
|
#5 |
|
If this is for an iPhone project, then compiling it for your Mac doesn't help. It will have to be compiled for ARM to work on the iPhone.
|
|
|
|
0
|
|
|
#6 | |||
|
Quote:
---------- Quote:
Thanks for your reply.. ---------- Quote:
---------- Can you please explain how I can compile for ARM so it work on the iPhone? and would it work on the simulator or it has to be a real device? |
||||
|
|
0
|
|
|
#7 | |
|
Quote:
ld: warning: ignoring file /Users/.../libjpeg.a, file was built for archive which is not the architecture being linked (i386) I guess I didn't build the library correctly. Do you know how I can build it to work with the iPhone and the simulator? I appreciate your help.. |
||
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 06:02 PM.







Linear Mode
