1
$\begingroup$

When displaying images with GraphicsRow, GraphicsColumn, and GraphicsGrid, a thin white border is added to the image. This makes it difficult to pad the image.

An example: example1

Is there a way to remove the border? Setting ImageMargins or ImagePadding to 0 does not work.

Code to reproduce the issue:

GraphicsRow[Table[Graphics@Disk[], 3], Background -> Blue] // 
 ImagePad[#, 50, Blue] & 

enter image description here

$\endgroup$
4
  • 2
    $\begingroup$ Here is a trick: GraphicsRow[Table[Graphics@Disk[], 3], Background -> Blue] // ImageCrop // ImagePad[#, 50, Blue] &. $\endgroup$
    – J.W Kang
    Jan 18, 2021 at 14:30
  • 2
    $\begingroup$ GraphicsRow[Table[Graphics@Disk[], 3], Background -> Blue, PlotRangePadding -> None] // ImagePad[#, 50, Blue] & $\endgroup$
    – Bob Hanlon
    Jan 18, 2021 at 15:01
  • $\begingroup$ @BobHanlon Thank you! What's the best practice when your question is answered in the comments? $\endgroup$
    – mikabozu
    Jan 18, 2021 at 15:06
  • 3
    $\begingroup$ I suggest that you answer your own question while acknowledging the help of others. $\endgroup$
    – Bob Hanlon
    Jan 18, 2021 at 15:11

1 Answer 1

1
$\begingroup$

The solution, provided by Bob Hanlon in the comments, is to set PlotRangePadding -> None. From the documentation:

"By default, 2% of padding is added to the plot range in each direction"

GraphicsRow[Table[Graphics@Disk[], 3], Background -> Blue, 
  PlotRangePadding -> None] // ImagePad[#, 50, Blue] &

fixed image

Another option, mentioned by J.W Kang in the comments is to use ImageCrop. This function will "remove borders of uniform color," ridding us of the pesky white border.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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