1
votes

I've created this theme after my previous post. I can't run the following code (written by @belisarius):

a = Image["path/file.png"]
b = Image@ArrayPad[ImageData@a, {{40, 0}, {40}, {0}}, {1, 1, 1}];
f[image_, angleMult_] := ImageForwardTransformation[image, (
    fi = ArcTan[Abs[#[[2]]/(#[[1]] - .5)]];
    fi1 = angleMult fi (#[[1]]^2 + #[[2]]^2)/2;
    {(1/2 - Sin[fi1] #[[2]] - Cos[fi1]/2 + 
       Cos[fi1] #[[1]]), -Sin[fi1]/2 + Sin[fi1] #[[1]] + 
      Cos[fi1] #[[2]]}) &]
t = Table[f[b, x], {x, 0, .2, .02}];
t1 = Reverse@t;
Export["anim.gif", Join[t, t1], "DisplayDurations" -> .15];
Import["anim.gif", "Animation"]

Here is a list of errors:

ArrayPad::depth: Padding amount {{40,0},{40},{0}} should specify padding in no more than the number of dimensions in array {{1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,0.996078,0.984314,<<142>>},<<49>>,<<145>>}. >>

Image::imgarray: The specified argument ArrayPad[{{1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,0.996078,0.984314,<<142>>},<<49>>,<<145>>},{{40,0},{40},{0}},{1,1,1}] should be an array of rank 2 or 3 with machine-sized numbers. >>

ImageForwardTransformation::imginv: Expecting an image or graphics instead of Image[ArrayPad[{{1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,0.996078,0.984314,<<142>>},<<49>>,<<145>>},{<<1>>},{1,1,1}]]. >>

General::stop: Further output of ImageForwardTransformation::imginv will be suppressed during this calculation. >>

Rasterize::bigraster: Not enough memory available to rasterize ImageForwardTransformation expression. >>

General::stop: Further output of Rasterize::bigraster will be suppressed during this calculation. >>

I'm using Mathematica 8 under Linux.

1
I use Mma on windows myself but I did a google search on pasting images into Linux on Mma and found this. It might be something you could try mathkb.com/Uwe/Forum.aspx/mathematica/16019/… - dbjohn
Start debugging by replacing the b=... in the second command by b=a, and let's see if it's a image formatting issue. - Dr. belisarius

1 Answers

5
votes

I think I got it.

The code above is for color images (3 channels) and it seems you are trying to run it over a B&W image (1 channel).

Either use a color image or replace the second line by:

b = Image@ArrayPad[ImageData@a, {{40, 0}, {40}}, 1];

Here is the result for your image using the above replacement as:

a = Binarize[Image["path/file.png"]]
b = Image@ArrayPad[ImageData@a, {{40, 0}, {40}}, 1];

alt text