Bug introduced in V9.0 or earlier and persisting through V11.2

pic2 = ImageResize[
  {Automatic, 40}]

enter image description here


enter image description here

This is just annoying...

Win 10 V10.3.1

Q: so, is there any quick fix? Have I missed something obvious?

p.s. e.g. Row works well but it is not Grid :-)

A support case with the identification [CASE:3522370] was created:

Thank you for contacting Wolfram Technical Support.

I have filed a report regarding the behavior you describe. The appropriate development team will be able to review the issue and hopefully implement a fix in a future version.

Fortunately this is not an issue with the object itself, but with its visual representation in the Mathematica front end. Although not a practical workaround, if you increase your magnification from 100% to 200%, you will notice the problem no longer persists. Similarly, if I printed the notebook demonstrating the issue I did not experience the clipping.

If you are able to get away without using ImageCrop, the issue does not seem to present itself. Without seeing your actual application it is difficult to provide a solution that will work in any scenario and still maintain the exact results you desire.

  • $\begingroup$ Grid[{{pic2}}, Frame -> All] clips the left side too. However, this can be repaired with Spacings. Unfortunately, Spacings does not repair the original problem; e.g., Grid[{{pic2}}, Frame -> All, Spacings -> {1, 1}]` $\endgroup$ – bbgodfrey Jan 28 '16 at 12:10
  • 1
    $\begingroup$ @bbgodfrey this is just ridiculous :-/ $\endgroup$ – Kuba Jan 28 '16 at 12:11
  • 1
    $\begingroup$ @Hubble07 let's go further and turn off the screen :p $\endgroup$ – Kuba Jan 28 '16 at 12:13
  • 1
    $\begingroup$ Removing ImageCrop works correctly... Strangely magnifying bigger than 1 also corrects it... $\endgroup$ – s.s.o Jan 28 '16 at 12:18
  • 1
    $\begingroup$ I'mu using version 10.3.0 Linux, and this does not happen, Grid shows the circle correctly with or without the Frame option $\endgroup$ – Jason B. Feb 2 '16 at 8:00

With Frame -> All, the automatic Spacings are weird. The automatic BaselinePosition is bad either way.

It seems to be a good idea to include substitutes for as many of those options which are Automatic by default as possible:

pic2 = ImageResize[ImageCrop@Rasterize@Graphics@Disk[], {Automatic, 40}];

Grid[{{pic2}}, Alignment -> {Center, Center}, Spacings -> {0, 0},
               BaselinePosition -> Center, Frame -> All]

enter image description here

  • $\begingroup$ When you put another Grid on that, the feature is back. It would be so nice to not have to care where the inner grid ends up. $\endgroup$ – Kuba Jan 28 '16 at 12:30
  • $\begingroup$ Grid@List@List@% $\endgroup$ – Kuba Jan 28 '16 at 12:30
  • 2
    $\begingroup$ Grid is terrible. I used this solution but then some glitches were introduced in the interior of the image, unfortunately, I can't share that image and I wasn't able to reproduce that problem with Graphics. That's crazy. $\endgroup$ – Kuba Jan 29 '16 at 9:29
  • 1
    $\begingroup$ @Kuba Don't I know it. :-p $\endgroup$ – Mr.Wizard Jan 29 '16 at 21:44
  • 1
    $\begingroup$ Due to all those issues I'm using in my UI ImagePad[pic2, 1, 1] or whichever value that fits the background. If such row is cut it's not a harm. $\endgroup$ – Kuba Feb 2 '16 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.