Output visual diagram of picture
Python 2, 98 bytes



w,h,a,b=input()
a*='+'
b*='#'
for c in b+a+h*'X'+a+b:print' '.join(min(c,d)for d in b+a+w*'X'+a+b)


Try it online!

Prints a space-separated grid, strictly following the spec. I'm amused that *= is used to convert a and b from numbers to strings.

Python 3 can save some bytes by avoiding ' '.join, maybe more by using f-strings and assignment expressions. Thanks to Jo King for -2 bytes.

Python 3, 93 bytes



def f(w,h,a,b):a*='+';b*='#';[print(*[min(c,d)for d in b+a+w*'X'+a+b])for c in b+a+h*'X'+a+b]


Try it online!