MathGroup Archive 2012

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

Search the Archive

Re: Add scale bar to Image

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126937] Re: Add scale bar to Image
  • From: ccarter at mit.edu
  • Date: Mon, 18 Jun 2012 05:47:34 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201206170756.DAA08820@smc.vnet.net>

Hello Slapjack,
This should help you get what you want:

testimage = Import["ExampleData/rose.gif"]

{width, height} = ImageDimensions[testimage]

scaledTicks[width_, labeledWidth_, nTicks_] :=
  Module[{baseTicks},
   baseTicks = N@FindDivisions[{0, labeledWidth}, nTicks];
   Transpose[{width/labeledWidth baseTicks, baseTicks}]
   ]

Show[testimage, Frame -> True,
  FrameTicks -> { {scaledTicks[height, 10, 2],
     None}, {scaledTicks[width, 1000, 6], None}}]


Craig


On Sun, 17 Jun 2012, slapjack0 at gmail.com wrote:

> Date: Sun, 17 Jun 2012 03:56:37 -0400 (EDT)
> From: slapjack0 at gmail.com
> To: mathgroup at smc.vnet.net
> Subject: Add scale bar to Image
> 
> Hello,
>
> I'm looking for a way to add a scale to an image (an imported TIFF file).
> I've searched the forums, but many answers are for Graphics (generated plots etc), not Images.
>
> I have,
> photo = Import["example.jpg"]
>
> If I use,
> Show[photo, Frame->True]
> the frame is very nice, but is it possible to scale the numbers it uses? (or somehow overlay a axis onto the image?)
>
> Thanks
>
>



  • Prev by Date: Eigendecomposition problem?
  • Next by Date: Re: Boundary condition of diffusion equation in a sphere
  • Previous by thread: Add scale bar to Image
  • Next by thread: Re: Add scale bar to Image