Re: Undocumented functions for working with graphics
- To: mathgroup at smc.vnet.net
- Subject: [mg101121] Re: Undocumented functions for working with graphics
- From: Alexey <lehin.p at gmail.com>
- Date: Wed, 24 Jun 2009 06:35:17 -0400 (EDT)
- References: <h0qogh$kkq$1@smc.vnet.net> <h0sbok$h8i$1@smc.vnet.net>
Thank you very much! The method you have described is great. Some times for using it I must launch Mathematica with "-cleanStart" key for clearing the dump. But for Image`ToGraphicsRaster I can not get your "clear" code. My result contains unknown functions like Image`ImageDump`list with no attributes: In[1]:= ClearAttributes[Image`ToGraphicsRaster, {Protected, ReadProtected}] ?Image`ToGraphicsRaster Output: Image`ToGraphicsRaster[Image`ImageDump`list:{_? Image`ValidImageQ..}]:=Image`ToGraphicsRaster/@Image`ImageDump`list Image`ToGraphicsRaster[Image`ImageDump`img_?Image`ValidImageQ]:=Module [{Image`ImageDump`width,Image`ImageDump`height,Image`ImageDump`range,Image`= ImageDump`cf,Image`ImageDump`data,Image`ImageDump`interleaving,Image`ImageD= ump`imsize}, {{Image`ImageDump`width,Image`ImageDump`height},Image`ImageDump`range,Image= `ImageDump`cf} =ImageData[Image`ImageDump`img, {ImageDimensions,DataRange,ColorFunction}]; {Image`ImageDump`interleaving,Image`ImageDump`imsize}= {Interleaving,ImageSize}/.Options[Image`ImageDump`img]/.Options [Image];If [Image`ImageDump`interleaving===False,Image`ImageDump`data=Reverse [ImageData[Image`ImageDump`img,Interleaving- >True]],Image`ImageDump`data=Reverse[First [Image`ImageDump`img]]];Graphics[Raster[Image`ImageDump`data,{{0,0}, {Image`ImageDump`width,Image`ImageDump`height}},Image`ImageDump`range,Color= Function- >Image`ImageDump`cf],If[Image`ImageDump`imsize===Automatic|| Image`ImageDump`imsize===All,ImageSize-> {Image`ImageDump`width,Image`ImageDump`height},ImageSize- >Image`ImageDump`imsize],PlotRange->{{0,Image`ImageDump`width}, {0,Image`ImageDump`height}}]] How did you get your "clear" code? On 12 Jun, 05:41, David Reiss <dbre... at gmail.com> wrote: > ...just following up on the method for reverse engineering of my > previous post, here is part of the code for ToGraphicsRaster obtained > using that approach: > > Image`ToGraphicsRaster[img_?Image`ValidImageQ] := > Module[{width, height, range, cf, data, interleaving, > imsize}, {{width, height}, range, cf} = > ImageData[ > img, {ImageDimensions, DataRange, ColorFunction}]; {interleaving, > imsize} = {Interleaving, ImageSize} /. Options[img] /. > Options[Image]; > If[interleaving === False, > data = Reverse[ImageData[img, Interleaving -> True]], > data = Reverse[First[img]]]; > "Graphics"[ > Raster[data, {{0, 0}, {width, height}}, range, > ColorFunction -> cf], > If[imsize === Automatic || imsize === All, > ImageSize -> {width, height}, ImageSize -> imsize], > PlotRange -> {{0, width}, {0, height}}]] > > On Jun 11, 7:06 am, Alexey <lehi... at gmail.com> wrote: > > > Hello, > > > Does anyone know where such functions as "Image`ToGraphicsRaster" an= d > > "Image`PossibleImageQ" are documented. Are there other such built-in > > functions? At this moment I even can't imagine from where (except this > > group) I could learn that functions mentioned exist... > >