Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10531

Re: Add scale bar to Image

From ccarter@mit.edu
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Add scale bar to Image
Date 2012-06-18 09:51 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jrmtmb$h7p$1@smc.vnet.net> (permalink)
References <201206170756.DAA08820@smc.vnet.net>

Show all headers | View raw


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@gmail.com wrote:

> Date: Sun, 17 Jun 2012 03:56:37 -0400 (EDT)
> From: slapjack0@gmail.com
> To: mathgroup@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
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Add scale bar to Image ccarter@mit.edu - 2012-06-18 09:51 +0000

csiph-web