« first day (3131 days earlier)      last day (1363 days later) » 

12:11 AM
Can someone with an older version of Mathematica check if this ever worked? The answer was written by me in 2015 and the result shown in the post cannot be reproduced anymore (I know why, but would like to know if it was different before).
 
12:30 AM
@C.E. I just did an image diff of the result shown in the answer, and the image produced by the code (at the top, not the modified) using 12.1, and they are identical?
downloading 10.0.2 now for comparison
 
@kirkus Weird, for me it looks like this in 12.1 on Linux:
 
The reason is that Graphics ignores the ImageSize option. If I use Rasterize it ignores the ImageSize option in that too.
 
12.1 Windows
 
Ok, so that could be part of the explanation then. I was using Mac OS in 2015.
 
12:39 AM
yikes
here's 12.1 Mac:
10.0.2 Windows freaks out, errors everywhere
 
oh man, they've really screwed something up. In something so simple as rasterizing a graphics with a specific image size.
 
that one's worth a bug submit
 
yup, I will report it.
@kirkus thank you for providing all these nice platform and version tests!
 
@C.E. anytime!
specifically that's macOS 10.15.6
now that is strange
I wonder if it's a high DPI issue
as soon as I change the line:
mask = Graphics[{White, Disk[{0, 0}, r2], Black, Disk[{0, 0}, r1]},
PlotRange -> 1, Background -> Black,
ImageSize -> ImageDimensions[image]/2];
on Mac, it works fine
 
12:57 AM
that's a nice insight. I didn't expect that this would be something that I as a programmer would have to deal with. If this is how it's going to work then I'm going to have to write If statements every time I rasterize something if I want the same result on every platform.
 
yeah, that should definitely be on their shoulders
I wonder if there's some implicit ImageResolution mismatch under the hood
wow, Trace gives a ton of info, impressive
seems to have no effect
 
1:14 AM
@C.E. Maybe related to the 12.1 change in ImageDimensions. See this.
 
1:28 AM
if I Rasterize[] the mask with ImageResolution->72, it works
still clunky
@C.E. what's your output on Linux for "Resolution" /. CurrentValue["ConnectedDisplays"]?
 
 
9 hours later…
10:41 AM
@RohitNamjoshi yes that seems to be it!
@kirkus It is 96. Using ImageResolution -> 72 works. So not a bug at all though, but an annoying effect of how they decided to handle higher resolution displays...
 
 
2 hours later…
12:47 PM
ok so you are right in between my Windows and Mac. Just out of curiosity, does the following work on your setup?

extractAnnulus[image_, {r1_, r2_}, sf_] :=
Module[{mask},
mask = Graphics[{White, Disk[{0, 0}, r2], Black, Disk[{0, 0}, r1]},
PlotRange -> 1, Background -> Black,
ImageSize -> ImageDimensions[image]/sf];
ImageAdd[ImageMultiply[image, mask], ColorNegate[mask]]]
imgRes = 72;
img = Import["http://i.stack.imgur.com/paxJ9.png",
ImageResolution -> imgRes];
scaleFactor =
Max["Resolution" /. CurrentValue["ConnectedDisplays"]]/imgRes;
 
1:05 PM
@kirkus yes it does
 
@C.E. ok thanks
 
2:00 PM
posted on August 14, 2020 by Devendra Kapadia

Linear algebra is probably the easiest and the most useful branch of modern mathematics. Indeed, topics such as matrices and linear equations are often taught in middle or high school. On the other hand, concepts and techniques from linear algebra underlie cutting-edge disciplines such as data science and quantum computation. And in the field of [...]

 
 
2 hours later…
4:20 PM
Does anyone know how to remove the padding in this inset? (essentially the part highlighted in green)
Graphics[
 {
  Point@{0, 0},
  Inset[
   Style["a)", Background -> Yellow],
   {0, 0},
   ImageScaled@{0, 0},
   BaseStyle -> {Background -> Green}
   ]
  },
 ImageSize -> 10
 ]
I tried all combinations of padding and margin settings I could think of, but no luck so far..
 
 
2 hours later…
6:26 PM
@LukasLang Don't have a solution, but also note that this is an issue
Framed[
 Style["a)", Background -> Yellow],
 Background -> Green,
 FrameStyle -> None,
 FrameMargins -> None,
 ImageMargins -> {{-1, -1}, {-3, -6}}
 ]
Which might suggest that the issue is in Style
Looking at this, StyleBox seems to add extraneous padding on top:
Row@{
  Framed[
   RawBoxes@
    AdjustmentBox[
     StyleBox[ToBoxes@"a)",
      Background -> Yellow
      ],
     BoxMargins -> {{0., 0.}, {.2, .7}}
     ],
   Background -> Green,
   FrameStyle -> None,
   FrameMargins -> None
   ],
  Framed[
   RawBoxes@
    AdjustmentBox[
     StyleBox[ToBoxes@"a)",
      Background -> Yellow
      ],
     BoxMargins -> {{0., 0.}, {0., 0.}}
     ],
   Background -> Green,
   FrameStyle -> None,
   FrameMargins -> None
   ]
  }
 
 
1 hour later…
 
2 hours later…
9:49 PM
`Thanks! This indeed solved it for me kirkus
 

« first day (3131 days earlier)      last day (1363 days later) »