This gives a list:

{ColorSpace -> 
   ColorProfileData[ ...], Interleaving -> True, MetaInformation -> {"Something"}}

I can update the values like:

Image[image, MetaInformation-> {"updated value"->"something"}]

The question is how can I prevent MetaInformation from being displayed by Options under some condition?

  • 2
    $\begingroup$ Under what condition? And why? $\endgroup$ – m_goldberg Dec 25 '15 at 14:31

MMA seems to treat images as atoms, so pattern matching inside an Image object appears difficult. How about splitting the image into data, type and options and replacing your option according to some rule:

replaceImageOptions[image_, rule_] := Module[{type, data, opts},
    type = ImageType[image];
    data = ImageData[image, type];
    opts = Options[image];
    Image[data, type, opts /. rule]

image = Import["https://upload.wikimedia.org/wikipedia/commons/c/c2/Amanita_muscaria_%28fly_agaric%29.JPG"];

image2 = replaceImageOptions[image, (MetaInformation -> _) -> Nothing];

(* {ColorSpace -> "RGB", Interleaving -> True, MetaInformation -> ... } *)

(* {ColorSpace -> "RGB", Interleaving -> True} *)

EDIT: In case you're just interested in suppressing MetaInformation from the output of Options and don't want to change anything in the image object, you could simply use

Options[image] /. (MetaInformation -> _) -> Nothing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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