iPhone Rejection for Private API calls

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
ncm123

Re: iPhone Rejection for Private API calls

Post by ncm123 »

Any help guys! Has the patch for TARGET_OS_IPHONE been added?

Thanks!

User avatar
magick
Site Admin
Posts: 11254
Joined: 2003-05-31T11:32:55-07:00

Re: iPhone Rejection for Private API calls

Post by magick »

One patch. We may have more. We need more time.

ncm123

Re: iPhone Rejection for Private API calls

Post by ncm123 »

No Problem! Thanks! Keep us posted.

cloud
Posts: 26
Joined: 2009-06-26T07:09:31-07:00
Authentication code: 8675309
Location: Zürich, Switzerland | Como, Italy

Re: iPhone Rejection for Private API calls

Post by cloud »

I have updated my script and compilation is working against iPhone OS, I have some problems for the Simulator (i386) regarding accelerate in the core part of the system.

I'm checking it up soon.

If you are working with the device please find the new script for compilation of 6.6.1-5 at github: http://github.com/marforic/imagemagick_lib_iphone

Regards,

~Claudio
IM compilation script and test project: https://github.com/marforic/imagemagick_lib_iphone (always up-to-date)
IM latest iOS binaries: ftp://ftp.imagemagick.org/pub/ImageMagick/iOS/

cloud
Posts: 26
Joined: 2009-06-26T07:09:31-07:00
Authentication code: 8675309
Location: Zürich, Switzerland | Como, Italy

Re: iPhone Rejection for Private API calls

Post by cloud »

Update: I can confirm everything working smooth on the simulator as well by compiling with the latest script.

I will make available compiled libraries for everyone soon, just let me upload everything to a server (and will update the post here with download links).

Thank you for the great work imagemagick developers and support for us iPhone compilers :)

UPDATE:

Here is the link to the latest compiled libraries: http://www.cloudgoessocial.net/im_iphon ... mpiled.zip
Here is the link to the latest IM_Test xcode porject: http://www.cloudgoessocial.net/im_iphon ... .6.1-5.zip
Here is the link to the latest compilation script: http://github.com/marforic/imagemagick_lib_iphone
IM compilation script and test project: https://github.com/marforic/imagemagick_lib_iphone (always up-to-date)
IM latest iOS binaries: ftp://ftp.imagemagick.org/pub/ImageMagick/iOS/

ncm123

Re: iPhone Rejection for Private API calls

Post by ncm123 »

Thanks for the post, cloud.

I tried to run your project in my simulator and as soon as i click on the image, the app crashes. It was the same on my iphone device. Is there something that I am missing?

I also tried to run my old project which was working excellent with the old libraries. But when I put your libraries in the project, its not working. Is there some change that needs to be made.

Thanks for all the help!

cloud
Posts: 26
Joined: 2009-06-26T07:09:31-07:00
Authentication code: 8675309
Location: Zürich, Switzerland | Como, Italy

Re: iPhone Rejection for Private API calls

Post by cloud »

I'm writing an image to /Users/cloud/Desktop/ find it and change it to your needs, that could be the problem.
IM compilation script and test project: https://github.com/marforic/imagemagick_lib_iphone (always up-to-date)
IM latest iOS binaries: ftp://ftp.imagemagick.org/pub/ImageMagick/iOS/

ncm123

Re: iPhone Rejection for Private API calls

Post by ncm123 »

Phew! I am glad it was my stupidity and not something else that was crashing the app. Thanks man. Your project works wonderfully well on my simulator.

Now, I just have to figure what is breaking my app.

Thanks again for all the wonderful support.

ncm123

Re: iPhone Rejection for Private API calls

Post by ncm123 »

Ok. I solved the error in my app. It was because of the libpng.a. I removed the new libpng and added the old libpng and my app started working.

cloud
Posts: 26
Joined: 2009-06-26T07:09:31-07:00
Authentication code: 8675309
Location: Zürich, Switzerland | Como, Italy

Re: iPhone Rejection for Private API calls

Post by cloud »

Can we know which error is? So I can look into it?
Thank you :)
IM compilation script and test project: https://github.com/marforic/imagemagick_lib_iphone (always up-to-date)
IM latest iOS binaries: ftp://ftp.imagemagick.org/pub/ImageMagick/iOS/

Vortec4800

Re: iPhone Rejection for Private API calls

Post by Vortec4800 »

Cloud, have you seen the sepia error I was talking about in the other thread (which I linked to earlier?) Everything works 100% in the simulator but not on the device.

I tried your libraries in my project and the sepia problem is still happening. Let me try your test project and see if it does it there too.

Vortec4800

Re: iPhone Rejection for Private API calls

Post by Vortec4800 »

Update:

I downloaded and tried your sample project with the latest libraries, and the same sepia issue is happening there too. If you replace your posterize image call with this:

Code: Select all

	status = MagickSepiaToneImage(magick_wand, 0.8 * QuantumRange);
	if (status == MagickFalse) {
		ThrowWandException(magick_wand);
	}
you'll see what I'm talking about. This works correctly in the simulator, but fails on my iPod Touch. It also fails on my iPhone, iPad, etc.

cloud
Posts: 26
Joined: 2009-06-26T07:09:31-07:00
Authentication code: 8675309
Location: Zürich, Switzerland | Como, Italy

Re: iPhone Rejection for Private API calls

Post by cloud »

It has to do with QuantumRange. It is defined in magick-type.h.

In particular note that IM for iPhone is compiled --with-quantum-depth=8.

A quick fix for you would be to have it hardcoded to 255UL with your code looking something like:

Code: Select all

#if TARGET_IPHONE_SIMULATOR
    status = MagickSepiaToneImage(magick_wand_local, 0.8 * QuantumRange);
#else
    status = MagickSepiaToneImage(magick_wand_local, 0.8 * 255UL);
#endif
Otherwise you can just grab the latest compiled libraries (http://www.cloudgoessocial.net/im_iphon ... 6_libs.zip) which work without that dirty fix I told you. Since I know you compiled the libraries yourself you can also update the script I'm using (http://github.com/marforic/imagemagick_lib_iphone) which is now fixed regarding this issue.

Thank you for discovering this problem and let me know if everything is working for you now.

~C
IM compilation script and test project: https://github.com/marforic/imagemagick_lib_iphone (always up-to-date)
IM latest iOS binaries: ftp://ftp.imagemagick.org/pub/ImageMagick/iOS/

Vortec4800

Re: iPhone Rejection for Private API calls

Post by Vortec4800 »

cloud wrote:It has to do with QuantumRange. It is defined in magick-type.h.

In particular note that IM for iPhone is compiled --with-quantum-depth=8.

A quick fix for you would be to have it hardcoded to 255UL with your code looking something like:

Code: Select all

#if TARGET_IPHONE_SIMULATOR
    status = MagickSepiaToneImage(magick_wand_local, 0.8 * QuantumRange);
#else
    status = MagickSepiaToneImage(magick_wand_local, 0.8 * 255UL);
#endif
Otherwise you can just grab the latest compiled libraries (http://www.cloudgoessocial.net/im_iphon ... 6_libs.zip) which work without that dirty fix I told you. Since I know you compiled the libraries yourself you can also update the script I'm using (http://github.com/marforic/imagemagick_lib_iphone) which is now fixed regarding this issue.

Thank you for discovering this problem and let me know if everything is working for you now.

~C
Worked perfectly. You sir, are awesome. I wish you much women and fortune in your future. :D


One last question. The framework runs painfully slow on the actual device. I'm not using any compression (which sped it up a bit at the cost of memory) and I resize any imported images to the max size the screen can display so we aren't doing unnecessary work. Are there any other optimizations I can do to help speed things up?

cloud
Posts: 26
Joined: 2009-06-26T07:09:31-07:00
Authentication code: 8675309
Location: Zürich, Switzerland | Como, Italy

Re: iPhone Rejection for Private API calls

Post by cloud »

Vortec4800 wrote: [...]
One last question. The framework runs painfully slow on the actual device. I'm not using any compression (which sped it up a bit at the cost of memory) and I resize any imported images to the max size the screen can display so we aren't doing unnecessary work. Are there any other optimizations I can do to help speed things up?
Not using compression should increase performance by around 3x, that's the most you can squeeze out. Only thing I would suggest is to add a "modal view" displaying a spinning cursor informing the user that the action is actually in progress ;)

~C
IM compilation script and test project: https://github.com/marforic/imagemagick_lib_iphone (always up-to-date)
IM latest iOS binaries: ftp://ftp.imagemagick.org/pub/ImageMagick/iOS/

Locked