ImageMagick on iPhone(png、jpeg)
来源:互联网 发布:招聘流程优化方案 编辑:程序博客网 时间:2024/06/16 05:20
I’m working on some iPhone applications, which need some image filtering. For now, I won’t say more! Stay tuned for the news when it comes out!
Long story short, I soon found the need (ant the challenge was a good one) to getImageMagick static libraries so that I can use it on the iPhone. Not only that, but withjpeg and png support. That’s what I need.
After a fast search through the net, I couldn’t find a single _GOOD_ post on how to do that. Just some bits and bytes – Nothing complete.
I soon set on a mission to get ImageMagick to work on the iPhone, as a library. And here’s the result of my quest (around 1 day of search, trials and errors, and at last some light!)
Setting
I’m running MacOSX 10.5.7, with the latest MacPorts installed. If you don’t, get it! I have many ports installed, the ones I “think” are important are:
- jpeg
- libpng
Also, I’m testing everything with the latest beta of the iPhoneOS 3.0 – It should be working also for 2.2.1 and the final 3.0 when it comes out.
The Script
I now provide you with a shell script that should do the whole trick of creating the static libraries needed in Xcode for iPhone development.
Just download it, give it run permission (chmod +x ./compile_im.sh
), and launch it. It will ask for your password because it needs to copy a file that is not owned by you, the user.
Before complaining that it’s not working, open it, and look at the required directory structure for it to work.
In particular you will need:
- a Desktop folder named cross_compile
- ImageMagick source: ImageMagick
- jpeg source: jpeg
– to which I’ve added the MacPorts patches
- libpng source: libpng
- Untar ImageMagick source and place it into ~/Desktop/cross_compile/i_m
- Untar/Unzip jpeg/libpng source and place it into: ~/Desktop/cross_compile/i_m/IMDelegates/jpeg-6b and ~/Desktop/cross_compile/i_m/IMDelegates/libpng-1.2.37
Now you can run the script :)
Result
The result will be stored under: ~/Desktop/tmp_target. In particular you can find all the header files needed while developing your application under:~/Desktop/tmp_target/im_libs/includes (divided by library). While all the static libraries are inside ~/Desktop/tmp_target/im_libs/:
- libjpeg.a
- libpng.a
- libMagickCore.a
- libMagickWand.a
Please note that the script joins both the i386 and the arm build inside one single .a static library to ease up developing (for testing both on the Simulator and on the device itself. When finishing up the application you may want to put only the arm library to make the overall application lighter.
XCode configuration
Step 1
To work with your libraries you need to put some easy adjustments to your Project in XCode. I’ve found that the best thing to do, especially in a shared environment with multiple developers, to just put everything inside the XCode project. To do so do:
- Project->Add To Project->Select all the .a libraries->Click ‘ADD’
- Project->Add To Project->Select the folders inside the ~/Desktop/tmp_target/im_libs/include->Click ‘ADD’
Step 2
Click on Project->Edit Project Settings and edit (in the Build:
- Other Linker Flags: -lMagickCore -lMagickWand -lz -lbz2 -ljpeg -lpng
- Header Search Paths: $(SRCROOT) – make it Recursive
- Library Search Paths: $(SRCROOT) – make it Recursive
- On the lower left click on the small-wheel and select: Add User-Defined Setting
- Key: OTHER_CFLAGS
- Value: -Dmacinsoth=1
This should be enough to make you start.
For the Lazy
If you’re lazy, don’t manage or for whatever other reason you can just download the whole compiled package
Last note
In case the script doesn’t work, you have questions/suggestions/support please don’t hesitate to contact me, and in case you need help with the script please send me the FULL output in a file../compile_im.sh > file_to_send.txt
转载:http://www.cloudgoessocial.net/2009/06/09/imagemagick-on-iphone-with-jpeg-png/
- ImageMagick on iPhone(png、jpeg)
- Installing ImageMagick with JPEG, TIFF and PNG Support
- iPhone UIImage保存到文件,PNG/JPEG自适应
- iPhone UIImage保存到文件,PNG/JPEG自适应
- iPhone UIImage保存到文件,PNG/JPEG自适应
- iPhone UIImage保存到文件,PNG/JPEG自适应
- GIF、JPEG、PNG比较
- gif,png,jpeg,区别
- install ImageMagick on Ubuntu
- php安装gd(freetype、jpeg、png、zlib)
- AE+C# 导出图片(BMP、JPEG、GIF、PNG、TIFF)
- java处理excel中图片(png,jpeg,jpg)
- php如何将webp格式图片转为jpeg(ImageMagick+libwebp)
- GIF 、JPEG、PNG的区别
- png、jpeg、bmp、gif区别
- JPEG vs PNG vs GIF
- pkg/33325:ImageMagick broken with new PNG
- PHP利用ImageMagick把PDF转成PNG
- 设置MAC OS远程登陆
- 用C#使用API即时判断当前的网络的连接方式
- NFS及NAS工作原理
- 数据库的查询优化技术1
- 我们社会的普遍价值观
- ImageMagick on iPhone(png、jpeg)
- 软件工程之用例模型总结
- web.xml里filter-mapping中的dispatcher的用途
- 12-1-11进步一小点
- 数据库的查询优化技术2
- Java栈与堆
- 将YUV或RGB的格式的数据保存为bmp文件
- DBID,SID,DB_NAME,DB_DOMAIN,INSTANCE_NAME,DB_UNIQUE_NAME,SERVICE_NAMES 及监听参数的说明
- ActionScript中的关键词