# What does ImageSize -> 1 -> 1 mean?

On the page http://www.wolfram.com/language/gallery/blur-faces-in-an-image/ the example code has ImageSize -> 1 -> 1. I am unfamiliar with this chaining of rules... What does it mean? Note I know what ImageSize does, it is the TWO arrows that I don't understand.

-
syntactically it sets the ImageSize option to the rule "1->1". What that means in terms of Graphics I don't know and It doesnt appear to be documented (It definitely does something , its not an error and its not the same as ImageSize->1 ) –  george2079 Mar 11 '14 at 19:02
FYI: This syntax is not recognized in version 7. –  Mr.Wizard Mar 12 '14 at 1:06

Using FullForm, you can see that ImageSize -> 1 -> 1 is the same as ImageSize -> (1 -> 1) i.e., the option value itself is a rule. This appears to be an undocumented shorthand for scaling a graphics to the correct image size or to scale up/down by a factor.

Observe the following, using a modified version of the example:

img = Import@"http://www.wolfram.com/language/gallery/blur-faces-in-an-image/images/O_1.png"

Clear@scale
scale[a_, b_] := Module[{faces = FindFaces[img]},
ImageDimensions@Graphics[Disk[Mean[##], First@Differences[##]/2] & /@ faces,
PlotRange -> Transpose[{{0, 0}, ImageDimensions[img]}], ImageSize -> a -> b]
]

scale @@@ Tuples[{1, 2}, 2]
(* {{285, 228}, {570, 456}, {143, 114}, {285, 228}} *)


{285, 228} is the size of img and the rest are scaled up/down. You can interpret the rule as ImageSize -> originalScale -> resizedScale. Leaving out this option is not the same, because then the size of the graphics is {360, 288}.

This is very handy when used with functions like ImageCompose, ImageAdd, ImageMultiply, because you can very easily set the mask to be the same size as the original image or scale the same mask for different sizes of the image without having to calculate or recompute the dimensions.

-