Update:
I've determined that my problem is partly specific to my 4k display. When I run the exact same code on a 2k display, I have no trouble at all, despite MMA still treating $ImageResolution
as 144. Additionally, some rasterized Graphics don't play well with Dynamics Graphics Primitives in v12.2. See below
The following code is flawless in v12.0, but in v12.2 it becomes almost unresponsive with large values for size
. For instance, a size
of 1500 is almost unusable on my machine in v12.2. With the graphic open, I literally can't even use the mouse to select text inside of a MMA notebook.
size = 500;
Show[
Rasterize@Graphics@Disk[],
Graphics@{Red, AbsolutePointSize@10,
Dynamic@Point@MousePosition["Graphics", {0, 0}]},
ImageSize -> size]
Original:
I have a GUI that is using Show
to render a dynamically updated graphic on top of a large, rasterized graphic. In version 12.0, this isn't an issue because you can easily set the ImageSize
and MMA displays it accordingly. In version 12.1 $ImageResolution
was introduced and things get tricky. For instance, in 12.2 (using macOS 10.14.6) Graphics
is ignoring $ImageResolution
, which results in a large graphics object that can cause the Front End to become very sluggish (even crash), specifically when combining the graphics with Dynamic
content (such as a Dynamic@MousePosition["Graphics"]
). In the following example, setting the $ImageResolution
doesn't work.
Unprotect[$ImageResolution];
$ImageResolution = 72;
Graphics[{Disk[]}, ImageSize -> 500]
ImageDimensions@%
{1000, 998}
Any clue how to force Graphics to use the value I'm assigning?
Note that in that example the final size of the Graphics is identical to the same code when run in 12.0, but it takes up more memory and gives me trouble when displaying larger graphics (such as over 20" wide). In many cases it is causing MMA to completely crash. My interactive graphics are never causing crashes in 12.0.
Also note that I know Graphics
is the function giving the trouble, consider the following;
Show[
Rasterize[ Graphics@Disk[], RasterSize -> 500],
ImageSize -> 500]
ImageDimensions@%
{500, 499}
Show[
Rasterize[Graphics@Disk[], RasterSize -> 500],
Graphics@{},
ImageSize -> 500]
ImageDimensions@%
{1000, 998}
Just including the empty Graphics
function is enough to double the actual ImageDimensions
of the graphic.