Bug introduced in 9.0.1 or earlier and fixed in 10.4.0

I have a Manipulate[ ] that displays an image with a superimposed Locator object. It works fine when I have SaveDefinitions->False but when I try to change False to True the image object changes (and is not displayed correctly). Here's an image which I load in and call img

my tif image

The Manipulate is this:

 img = Import["http://i.stack.imgur.com/xKudh.png"];
 Manipulate[img, {p, Locator}, SaveDefinitions -> False]

If you evaluate this, it displays the image with a locator object in the bottom left. All is well. But if you now evaluate

 Manipulate[img, {p, Locator}, SaveDefinitions -> True]

it displays not the image, but a long list of numbers starting with:

Image[{{244,243 ....

In trying to debug, I note that ImageQ[img] is True after evaluating the first Manipulate but is False after evaluating the second. This does not occur with all images (I tried a jpeg) but seems to happen with my .tif files (like the one above). Mathematica 9.0.1 Mac OS. I just noticed that when I uploaded the image, it was converted to a .png file. The same (bad) behavior occurs with this file as well.

The same bad behavior is still happening in version 10.0.2.

  • $\begingroup$ Both Manipulates work for me in 8.0.4 on Windows 7. $\endgroup$ Mar 20, 2013 at 7:28
  • $\begingroup$ Both work fine on my installation -- V9.0.1 running on OS X (10.6.8) $\endgroup$
    – m_goldberg
    Mar 20, 2013 at 8:11
  • $\begingroup$ m_goldberg Wow... that's weird. I just tried (again) with a new launch and it's still happening -- though my system seems identical to yours. Thanks for checking. $\endgroup$
    – bill s
    Mar 20, 2013 at 8:20
  • $\begingroup$ I see no difference PC WinXP, Math $\endgroup$ Mar 20, 2013 at 8:20
  • $\begingroup$ I can reproduce this behaviour. 9.0.1 on OS X 10.8.3. When SaveDefinitions is set to True, the structure of img is changed from Image[RawArray["Byte",{{... to Image[{{...}}, Byte, ColorSpace -> ..., Interleaving -> ...]. I have no idea why the symbol img is modified. $\endgroup$
    – rm -rf
    Mar 20, 2013 at 8:21

2 Answers 2


Try this:

img = Image@ImageData@Import["http://i.stack.imgur.com/xKudh.png"];
Manipulate[img, {p, Locator}, SaveDefinitions -> True]

or this

img = Import["http://i.stack.imgur.com/xKudh.png"];
 img = Quiet[img /. ColorProfileData[] -> Automatic], {p, Locator}, 
 SaveDefinitions -> True]

I think the problem is how the image is stored when it is imported. I do not know anything about this, so perhaps others better versed in image processing will know what it is. Here is an image of the FullForm of Import["http://i.stack.imgur.com/xKudh.png"]:


When Manipulate converts it to some saved format, it must be mangling the ColorSpace option. It gets converted to ColorSpace -> ColorProfileData[], which is invalid. Setting it to Automatic seems to work, except that in generates a message somewhere in the Manipulate; hence the Quiet.

It seems to be a bug, but in the meantime, you have a workaround.

  • $\begingroup$ thanks for this. It's just happened to me again, and your ColorProfileData fix works perfectly. $\endgroup$
    – bill s
    May 25, 2013 at 5:18
  • 1
    $\begingroup$ Another work-around that may or may not be applicable depending on how one uses the image: img = Import["http://i.stack.imgur.com/xKudh.png", "Graphics"]; $\endgroup$
    – Mr.Wizard
    May 26, 2015 at 13:31
  • $\begingroup$ @bills You might be interested in Mr.Wizard's comment. $\endgroup$
    – Michael E2
    May 26, 2015 at 13:33

This isn't really an answer, but I sent the question to Wolfram. They replied:

The problem reported by you about SaveDefinitions option with Manipulate was reproducible. It has been forwarded to the development team for further investigation. You will be informed via email when it gets fixed.

I'll report back here if they respond.

Update: version 10.3.1 which is said to have "More robust import of image file formats, including JPEG and TIFF" still experiences the same odd behavior.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.