Page 1 of 1

Different output in local OS X and production Ubuntu 12.04

Posted: 2013-05-15T13:51:06-07:00
by hakunin
This problem has a few moving parts, but let me try to be clear and concise.

Our production Ubuntu 12.04 is running 6.6.9-7 (latest in official apt-get)
My local OS X is running 6.8.0-10 (newer)

So far all my complex scripts worked identically locally and in production, but this one latest script shows up too dim in production (while being perfect in development).

The only major differences between this and other scripts:
  • I started using .mpc format to dump intermediate mask (I create mpc file locally, and deploy it to production)
  • I started using "screen" composition, that I haven't ever used before
I could solve this problem by either:
  • changing said script
  • installing same version of ImageMagick to production as I have locally
    (frankly, not even sure this would fix it)
So it's a two-part question:

Am I making a mistake by using .mpc format across different machines and operating systems? Could this be the problem?

If it's not that, how can I install newer ImageMagick on Ubuntu 12.04? I already learned that I can't compile from source because I don't have enough RAM for compilation on production servers. I'm also not sure if I can re-create the deb package myself, because I looked at existing one, and it has a very complex makefile, and patches applied. Sounds pretty hard. Ideally, is there any source where I can get newer deb files of ImageMagick?

Re: Different output in local OS X and production Ubuntu 12.

Posted: 2013-05-15T15:46:18-07:00
by fmw42
Am I making a mistake by using .mpc format across different machines and operating systems? Could this be the problem?
Possibly. Magick would have to answer, but MPC format may have evolved from version to version.

You have not said what command you were using. Between the two versions, colorspace and grayscale have been changed. see viewtopic.php?f=4&t=21269

This could be the root of the problem, also. If MPC is stable, then you may need to use extra commands to adjust colorspace and or grayscale in the newer version of IM to make it match the older version of IM.

It might be helpful if you post links to your input and output images so we can see what the issue might be. And post the command line used to process the image.

Re: Different output in local OS X and production Ubuntu 12.

Posted: 2013-05-17T17:38:58-07:00
by hakunin
After some research, and thanks to fmw's answer above, I discovered that both my mpc files and the colorspace could've been the root of the problem. However, I'm not sure what's the best way to fix it now.

Here's what happens:

1. If I take my local MPC file, upload it to production (with older IM) and convert it to PNG in production by running `convert foo.mpc foo.png` — I get a very dim looking png — this was the problem all along. Older ImageMagick loaded my MPC incorrectly.

2. If I take the original, untouched PNG file I have, upload it to production, and create MPC from it using the older ImageMagick directly — everything works.

The problem is — I'd like to use the same MPC file locally and in production, so I was trying to make older (production) ImageMagick load my local MPC file correctly. I thought the reason it looked dim was due to colorspace. So I tried uploading my local MPC file to production again, and running these commands in production:

Code: Select all

convert -colorspace sRGB foo.mpc foo.png
and

Code: Select all

convert -colorspace RGB foo.mpc foo.png
hoping that if this PNG comes out looking right, then I am using the right colorspace to load this alien MPC file. Unfortunately, every time the PNG came out dim, as if -colorspace setting didn't matter.

What would be the proper way for me to load MPC file created by ImageMagick 6.8.0-10 in ImageMagick 6.6.9-7?

Re: Different output in local OS X and production Ubuntu 12.

Posted: 2013-05-17T17:43:26-07:00
by hakunin
Follow up question: what is the next most performant format to use if I was to abandon MPC?

Re: Different output in local OS X and production Ubuntu 12.

Posted: 2013-05-17T18:18:03-07:00
by hakunin
Just to highlight in case it wasn't clear from previous posts, this issue was entirely resolved by avoiding MPC files, and using PNG instead. While not ideal, I decided to abandon this optimization for now.

Re: Different output in local OS X and production Ubuntu 12.

Posted: 2013-05-18T02:44:51-07:00
by snibgo
hakunin wrote:Follow up question: what is the next most performant format to use if I was to abandon MPC?
For fastest but portable performance, I use uncompressed ("+compress") tiff.

Re: Different output in local OS X and production Ubuntu 12.

Posted: 2013-05-18T10:17:30-07:00
by fmw42
You could also try NetPBM PAM format. See http://netpbm.sourceforge.net/doc/pam.html It does support transparency.

Re: Different output in local OS X and production Ubuntu 12.

Posted: 2013-05-18T12:14:25-07:00
by hakunin
snibgo wrote:For fastest but portable performance, I use uncompressed ("+compress") tiff.
fmw42 wrote:You could also try NetPBM PAM format.
Thanks, will keep this in mind. However, if I do manage to load the same MPC with proper colorspace in different IM versions, I should be fine with MPC. Will also do some benchmarks when I get some time. Would be nice to pit PNG, TIFF, PAM, and MPC against one another.

Re: Different output in local OS X and production Ubuntu 12.

Posted: 2013-05-18T15:11:00-07:00
by fmw42
I did some time tests between png, (uncompressed) tiff and mpc. (For some odd reason I could not convert this image to pam, though I could with a reduced version of the image. So perhaps PAM has a dimension limit). MPC wins hands down.

I converted this image to each format. http://en.wikipedia.org/wiki/File:Barns ... tetons.jpg


time for ((i=0; i<1000; i++)); do
convert barn2.png null:
done
36.4 seconds


time for ((i=0; i<1000; i++)); do
convert barn2.tif null:
done
22.2 seconds



time for ((i=0; i<1000; i++)); do
convert barn2.mpc null:
done
12.9 seconds

EDIT:

I got the image converted to pam (by adding -strip).


time for ((i=0; i<1000; i++)); do
convert barn2.pam null:
done
20.1 seconds

Re: Different output in local OS X and production Ubuntu 12.

Posted: 2013-05-18T19:13:18-07:00
by hakunin
fmw42 wrote:I did some time tests
Awesome, thanks for trying these (I'm a bit swamped). This confirms that it's worth it to switch to MPC when running conversions at scale.