MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Imported Image In Manipulate Resizing in 7

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102595] Re: Imported Image In Manipulate Resizing in 7
  • From: Chris Degnen <degnen at cwgsy.net>
  • Date: Sun, 16 Aug 2009 06:40:23 -0400 (EDT)

Seems it's down to automatic resizing in Manipulate.

I got the graphic to display properly by using a Manipulate
option: ContentSize, i.e.

Manipulate[DynamicModule[{}, insetgrid],
 ContentSize -> {700, 507}]

I had to guess the parameters.  ContentSize -> {700, 508}
doesn't work so well.  Some peculiarities to do with the scaling I
guess.  There doesn't seem to be a way to see what the exact size
should be.


----- Original Message -----
Newsgroups: comp.soft-sys.math.mathematica
Sent: Saturday, August 15, 2009 4:25 PM
Subject: [mg102595] Imported Image In Manipulate Resizing in 7


I am seeing some irregular treatment of imported images in a
Dynamic Module.  On version 7.0.0 the code below shows
different results for its two outputs, which are an inset grid and a
Manipulate window showing the same.  They should display the
same, and indeed they do in version 6.0.2.0.  (I haven't been able
to test it in Version 7.0.1 so far.)

The results are displayed as soon as the code is run.  The problem
seems to be that PlotRange is affected inside a Dynamic
Module, at least in version 7.0.0.

The code below tries three alternative types of inset square.  In
both versions 6 and 7, if the "plain graphics square" is used
everything works fine.  The problem occurs with imported
bitmap graphics.  Alternative versions of the square are included
which replicate an imported bitmap of 59 x 59 pixels.

Suggestions on how to fix the image in Dynamic Module
appreciated.


(* Plain graphics version *)
square = Graphics[{Red, Rectangle[{0, 0}, {59, 59}]},
   PlotRange -> {{0, 59}, {0, 59}}, ImageSize -> {59, 59}];

(* Representation of imported BMP (59 x 59 pixels), version 6 style *)
square = Graphics[
   Raster[Table[
     Table[{0, 255, 255}, {59}], {59}], {{0, 0}, {59, 59}}, {0, 255},
    ColorFunction -> RGBColor], ImageSize -> {59, 59},
   PlotRange -> {{0, 59}, {0, 59}}];

(* Representation of imported BMP (59 x 59 pixels), version 7 style *)
If[StringTake[$Version, 1] === "7",
  square = Image[Table[Table[{0, 255, 255}, {59}], {59}],
    ColorSpace -> "RGB", ImageSize -> {59, 59}]];

grid = Graphics[{Black, Rectangle[{0, 0}, {481, 481}],
    Inset[square, {30.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 30.5}, {Center, Center}, {59, 59}],
    Inset[square, {30.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 90.5}, {Center, Center}, {59, 59}],
    Inset[square, {30.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 150.5}, {Center, Center}, {59, 59}],
    Inset[square, {30.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 210.5}, {Center, Center}, {59, 59}],
    Inset[square, {30.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 270.5}, {Center, Center}, {59, 59}],
    Inset[square, {30.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 330.5}, {Center, Center}, {59, 59}],
    Inset[square, {30.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 390.5}, {Center, Center}, {59, 59}],
    Inset[square, {30.5, 450.5}, {Center, Center}, {59, 59}],
    Inset[square, {90.5, 450.5}, {Center, Center}, {59, 59}],
    Inset[square, {150.5, 450.5}, {Center, Center}, {59, 59}],
    Inset[square, {210.5, 450.5}, {Center, Center}, {59, 59}],
    Inset[square, {270.5, 450.5}, {Center, Center}, {59, 59}],
    Inset[square, {330.5, 450.5}, {Center, Center}, {59, 59}],
    Inset[square, {390.5, 450.5}, {Center, Center}, {59, 59}],
    Inset[square, {450.5, 450.5}, {Center, Center}, {59, 59}]},
   PlotRange -> {{0, 481}, {0, 481}}, ImageSize -> 481];

insetgrid =
 Graphics[{Green, Rectangle[{0, 0}, {680, 481}],
   Inset[grid, {0, 0}, {0, 0}, {481, 481}
    ]}, PlotRange -> {{0, 680}, {0, 481}}, ImageSize -> 680]

Manipulate[
 DynamicModule[{},
  Graphics[{Green, Rectangle[{0, 0}, {680, 481}], Inset[
     grid, {0, 0}, {0, 0}, {481, 481}
     ]}, PlotRange -> {{0, 680}, {0, 481}}, ImageSize -> 680]],
 SaveDefinitions -> False]



  • Prev by Date: Re: Intersection of line and a surface of revolution - a problem with
  • Next by Date: Logarithmic Axes for ListPlot3D
  • Previous by thread: Re: Whitcomb supercritical airfoil wings in a Mathematica model
  • Next by thread: Imported Image In Manipulate Resizing in 7