[Question]
  [
## Input
An \$m\$ by \$n\$ binary matrix, with \$m\$ and \$n\$ both at least 2.
Think of the ones as gobs of melted cheese, which stretch as we expand the matrix horizontally and vertically.
More precisely...
## Output
A \$2m-1\$ by \$2n-1\$ binary matrix, constructed as follows...
First insert rows of zeros between the rows, and insert columns of zeros between the columns. For example, consider the input:
```
0 1 1
1 0 1
1 0 0
```
After we insert the zeros:
```
0 0 1 0 1
0 0 0 0 0 
1 0 0 0 1
0 0 0 0 0 
1 0 0 0 0
```
To make it extra clear what we're doing, here is the same matrix with the *new* zeros visualized as `#`:
```
0 # 1 # 1
# # # # # 
1 # 0 # 1
# # # # # 
1 # 0 # 0
```
Now, for each new `0` (or `#` in our visualization), if is between two ones (horizontally, vertically, or diagonally), convert it to a 1:
```
0 # 1 1 1
# 1 # 1 1 
1 # 0 # 1
1 # # # # 
1 # 0 # 0
```
Or, exiting our visualization and converting `#` back to `0`:
```
0 0 1 1 1
0 1 0 1 1 
1 0 0 0 1
1 0 0 0 0 
1 0 0 0 0
```
And that is the actual, final result you return.
## Rules
* This is code golf with standard site rules
* You may take input in any reasonable format (array of arrays, built-in matrix type, single flat list, etc)
	+ With one exception: you may not take a list of the coordinates of the ones.
	+ This exception applies to the output as well: you must output all of the zeros and ones in some reasonable form.
* You may optionally take \$m\$ and \$n\$ as a second argument
* You can do I/O using images, so long as there is a 1-1 mapping with the matrix entries.
## Brownie Points
* Solution using images for I/O.
* J solution under 47 bytes.
## Test Cases
```
1 0
0 1
->
1 0 0
0 1 0
0 0 1
1 1
0 1
->
1 1 1
0 1 1
0 0 1
1 1
1 1
->
1 1 1
1 1 1
1 1 1
1 1
0 0
->
1 1 1
0 0 0
0 0 0
1 1 0 1 0 1
1 0 0 1 0 0
0 1 0 0 1 0
0 1 0 0 1 1
1 0 1 0 0 0
->
1 1 1 0 0 0 1 0 0 0 1
1 1 0 0 0 0 1 0 0 0 0
1 0 0 0 0 0 1 0 0 0 0
0 1 0 0 0 0 0 1 0 0 0
0 0 1 0 0 0 0 0 1 0 0
0 0 1 0 0 0 0 0 1 1 0
0 0 1 0 0 0 0 0 1 1 1
0 1 0 1 0 0 0 0 0 0 0
1 0 0 0 1 0 0 0 0 0 0
```
  
[Answer]
# [Python 3](https://docs.python.org/3/) with [numpy](https://numpy.org/), ~~97~~ 70 bytes
```
lambda m:abs(diff(diff(kron(m,1j**eye(2))),1,0))>=2
from numpy import*
```
[Try it online!](https://tio.run/##ZY29DoIwFEZ3nqJjSzq0upHohquLGzJUaWOV/uRSVJ4eQWgU/ZI296TfPfVduDi77tXm2NfCnCqBTCZODa60UtN1A2exofyaprKTeEUIoZwyQrabVaLAGWRb4zukjXcQ0j5AlyVoyOOia4kO0MqJx3jQNmCF5V3UWFvfBjz4SCKfZ@kDyve7HMBBhrxomr4oho9KWjDKyzIZif8R/3ljkSibzrvDZpptkRcUmxN/e6LlM7/7s2@5HzvlCw "Python 3 – Try It Online")
The basic idea is this: Expand each element into a 2-by-2 block, then look at each 2-by-2 square (overlapping) in the resulting matrix; each square should correspond to a 1 iff it contains a pair of diagonally opposite 1s.
The implementation works a bit differently. `kron` expands each 1 into `1j**eye(2)`, which is
\$ \begin{array}{|c|c|} \hline i & 1 \\ \hline 1 & i \\ \hline \end{array} \$, and taking `diff` in both directions is equivalent to a sum with multipliers \$ \begin{array}{|c|c|} \hline 1 & -1 \\ \hline -1 & 1 \\ \hline \end{array} \$ on each 2-by-2 square (overlapping). Then, each square contains two diagonally opposite nonzero values iff its result has real or imaginary component at least 2 in absolute value, which with integer components is equivalent to its own absolute value being at least 2.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~45~~ ~~38~~ ~~19~~ 16 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
2F€Dø€ü2}εε`RøPà
```
-19 bytes porting [*@m90*'s Python answer](https://codegolf.stackexchange.com/a/245610/52210), so make sure to upvote him/her as well!  
-3 bytes thanks to *@m90*.
[Try it online](https://tio.run/##yy9OTMpM/f/fyO1R0xqXwzuA5OE9RrXntp7bmhB0eEfA4QX//0dHG@oY6hhAcKxONIiG8AyAPCgLRKLwYCohfIPYWAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V@m5JlXUFpipaCkU3lotw6Xkn9pCYyv9N/I7VHTGpfDO4Dk4T1Gtee2ntuaEHR4R8DhBf@V9MKA6g9ts/8fHR1tqGMQqxNtoGMYG6ujAOIaYnIN0WUN4FwdAwgGqzKA8qAmwvgoPJhKCB9uEMIYA5ihsbGxAA) or [try it online with step-by-step debug lines](https://tio.run/##VU@7TsNAEOz5ipHrQ7JdmoKCgESHktKyxNpZx6c4d6fLJXJDw5fwAbRBkaCK@3wEP2LuYghQ7GN2RzO7ek2l5GGI7pXZuAyROLyLw9v1RTRzbJBkuO0MqTmYqgZbajcMp0FIuxRlq6vlFcLaNaxQWSbH0Fu2LRkj1eKXtoauAwusnLSMFTkru2CY3n0@v076vc/9R/o0@WOfZrhpuFqi1na8QNZg6WXsSWtFUmEuaaEVtfCc04C8w@V5St6s1K4Jv0TiuDvuHqf9/qF/Kfynw5DniUhEPEYh8lBHFHv03YX8D/0wRxwXxRc).
**Explanation:**
```
2F       # Loop 2 times:
  €D     #  Duplicate each value in the current list
  ø      #  Zip/transpose; swapping rows/columns
   €     #  For each inner list:
    ü2   #   Create overlapping pairs
}        # Close the loop
         # (we now have overlapping 2x2 blocks of the input-matrix after that has been
         # expanded to 2x2 for each individual value)
 ε       # Map over each list of blocks:
  ε      #  Map over each 2x2 block:
   `     #   Pop and push both pairs separated to the stack
         #    STACK: [[a,b],[c,d]] → [a,b] and [c,d]
    R    #   Reverse the top pair
         #    STACK: [a,b] and [d,c]
     ø   #   Create pairs of these two pairs
         #    STACK: [[a,d],[b,c]]
      P  #   Take the product of each inner pair to check if both are 1
         #    STACK: [a*d,b*c]
       à #   Take the maximum to check if either was truthy
         #   (so whether the diagonal or anti-diagonal of the 2x2 block were both 1s)
```
---
**Original ~~45~~ 38 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) answer:**
```
2Føε0ìSĆ]2Fø€ü3}εε2FøíÐÅsˆÅ\ˆ}¯ειPà}à´
```
[Try it online](https://tio.run/##yy9OTMpM/f/fyO3wjnNbDQ6vCT7SFgviPGpac3iPce25ree2griH1x6ecLi1@HTb4daY0221h9YDJXYGHF5Qe3jBoS3//0dHG@oY6hhAcKxONIiG8AyAPCgLRKLwYCohfIPYWAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V@m5JlXUFpipaCkU3lotw6Xkn9pCYyv9N/I7fCOc1sNDq8JPtIWC@I8alpzeI9x7bmt57aCuIfXHp5wuLX4dNvh1pjTbbWH1gMldgYcXlB7eMGhLf@V9MKARh7aZv8/OjraUMcgVifaQMcwNlZHAcQ1xOQaossawLk6BhAMVmUA5UFNhPFReDCVED7cIIQxBjBDY2NjAQ) or [try it online with step-by-step debug lines](https://tio.run/##VVC9TsMwGNx5ik@dQApq0jBlYaBCYkMqW8ngNl8bC8cOttOWoQtSO/MIfYAiFopAZYrZKvUheJHgNA1qZfnnpPPdfScU6VEsisYNTzMdQMPJ107@cXnS6GhMwQugk0kpMh4Bkn4MI8IyhDHVMbiqpLeuzed25Zpl52ceto8@twK4kkg0ghihZCRNKR@CP/Ghx0T/QYEYgI4REqIlndRiv89L8@1P2wdCfgB3knA1EDKpYvyLgBZA4DEjUqPeCUqaMtQKThMaRQxBinGzL1iW8GZEyVBwwpqEa3peo7PSebvarkp382pezExt5mZ2v5lP87f8PTyMcmFnitH62ixVFDoAtHWgrGapTKkCwuzs0RN4DlgqtYnUvsmyhV2PliQResKW6dUh7Pq6NYupWYS2zKLodj3Hc9xqh063vCvkWrR/lecRqpkVdsPwDw).
**Explanation:**
Step 1: Surround each value with 0s (including a border of 0s around the entire matrix, unlike the challenge description):
```
2F         # Loop 2 times:
  ø        #  Zip/transpose; swapping rows/columns
           #  (which will use the implicit input-matrix in the first iteration)
   ε       #  Map over each inner list:
    0ì     #   Prepend a 0 in front of each digit
      S    #   Then convert it to a flattened list of digits
       Ć   #   Enclose; append its own head (for the trailing border of 0s)
]          # Close both the inner map and outer loop
```
Step 2: Create overlapping 3x3 blocks of this matrix:
```
2F         # Loop 2 times again:
  ø        #  Zip/transpose; swapping rows/columns
   €       #  For each inner list:
    ü3     #   Create overlapping triplets
}          # Close the loop
```
Step 3: Transform each 3x3 block to a quartet of triplets of its middle row; middle column; main diagonal; and main anti-diagonal:
```
ε          # Map over each list of blocks:
 ε         #  Map over each 3x3 block:
  2F       #   Loop 2 times:
    øí     #    Rotate the 3x3 block 90 degrees clockwise:
    ø      #     Zip/transpose; swapping rows/columns
     í     #     Reverse each inner row
      Ð    #    Triplicate this 3x3 block
       Ås  #    Pop one, and push its middle row
         ˆ #    Pop and add this triplet to the global array
       Å\ˆ #    Do the same for the main diagonal
   }¯      #   After the loop: push the global array
```
Step 4: Check if either the middle is already 1, or if any sides of a middle row/column/diagonal/anti-diagonal are both 1:
```
  ε        #   Map over the list of triplets:
   ι       #    Uninterleave it from [a,b,c] to [[a,c],[b]]
    P      #    Take the product of each inner list: [a*c,b]
     à     #    Pop and push the maximum
  }à       #   After the map: pop and push the maximum
    ´      #   And clear the global array
           # (after which the result is output implicitly)
```
[Answer]
# [PARI/GP](https://pari.math.u-bordeaux.fr), 82 bytes
```
m->matrix(2*#m~-1,2*#m-1,x,y,m[i=x++\2,j=y++\2]*m[k=i+x%2,l=j+y%2]||m[i,l]*m[k,j])
```
[Attempt This Online!](https://ato.pxeger.com/run?1=TY5BCoMwFESvIhYhmi8krkol7rsqdGtDcWOJNRIkQgTpRboRSumqB-ptGo2Ci2TeZOZ_8vyoohXXmxpfpcfenS7j_e8s40wWuhUGJdFOPmIKk1ox0IPMBTMYXxKoWD8pj2R-ZwKbIIGaVbgPEj4Mtgb1HEHFw2Xzt1Cq7pH04sxTrWg08o_NwQ9T5xSSKyL_1OltUtosBC_PKZCUAOWWKdAt0u0rWRCIO-l0O57nV7dh13GO8PXT4-j0Dw)
[Answer]
# [Octave](https://www.gnu.org/software/octave/), 45 bytes
A port of [@m90's Python (NumPy) answer](https://codegolf.stackexchange.com/a/245610/9288).
```
@(m)abs(diff(diff(kron(m,[i,1;1,i])),1,2))>=2
```
[Try it online!](https://tio.run/##y08uSSxL/Z@mYKunp/ffQSNXMzGpWCMlMy0NQmQX5edp5OpEZ@oYWhvqZMZqauoY6hhpatrZGv1P04g21DGwNtAxjNXkAnMMUTmGqDIGcI6OAQRbg0gIG2wOjIfEhqiB8IAG/AcA "Octave – Try It Online")
---
# [Octave](https://www.gnu.org/software/octave/), 70 bytes
-5 bytes thanks to @Luis Mendo.
```
@(m)(n=kron(m,e(2)))(i=1:end-1,j=1:end-1)&n(i+1,j+1)|n(i,j+1)&n(i+1,j)
```
[Try it online!](https://tio.run/##y08uSSxL/Z@mYKunp/ffQSNXUyPPNrsoP08jVydVw0hTU1Mj09bQKjUvRddQJwvG0lTL08jUBgpoG2rWAJlgBkxM83@aRrShjoG1gY5hrCYXmGOIyjFElTGAc3QMINgaRELYYHNgPCQ2RA2EBzTgPwA "Octave – Try It Online")
## how
Takes `m = [0 1 1; 1 0 1; 1 0 0]` as an example:
```
octave:1> m = [0 1 1; 1 0 1; 1 0 0]
m =
   0   1   1
   1   0   1
   1   0   0
octave:2> n = kron(m,e(2))    # Repeats each element by 2x2
n =
   0   0   1   1   1   1
   0   0   1   1   1   1
   1   1   0   0   1   1
   1   1   0   0   1   1
   1   1   0   0   0   0
   1   1   0   0   0   0
octave:3> n11 = n(1:end - 1, 1:end - 1)
n11 =
   0   0   1   1   1
   0   0   1   1   1
   1   1   0   0   1
   1   1   0   0   1
   1   1   0   0   0
octave:4> n12 = n(1:end - 1, 2:end)
n12 =
   0   1   1   1   1
   0   1   1   1   1
   1   0   0   1   1
   1   0   0   1   1
   1   0   0   0   0
octave:5> n21 = n(2:end, 1:end - 1)
n21 =
   0   0   1   1   1
   1   1   0   0   1
   1   1   0   0   1
   1   1   0   0   0
   1   1   0   0   0
octave:6> n22 = n(2:end, 2:end)
n22 =
   0   1   1   1   1
   1   0   0   1   1
   1   0   0   1   1
   1   0   0   0   0
   1   0   0   0   0
octave:7> (n11 & n22) | (n12 & n21)
ans =
  0  0  1  1  1
  0  1  0  1  1
  1  0  0  0  1
  1  0  0  0  0
  1  0  0  0  0
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 15 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
żḢS€E?ƝẎ)Z$⁺Ạ€€
```
A monadic Link that accepts a list of lists of `1`s and `0`s and yields a list of lists of `1s` and `0`s.
**[Try it online!](https://tio.run/##y0rNyan8///onoc7FgU/alrjan9s7sNdfZpRKo8adz3ctQAoBET/H@7e8nDHJiAr7HC7@///hgqGCgYQzAUiIWwDLigNIpHYEDUQngEA "Jelly – Try It Online")** Or see the [test-suite](https://tio.run/##y0rNyan8///onoc7FgU/alrjan9s7sNdfZpRKo8adz3ctQAoBET/H@7e8nDHJiAr7HC7O9fRyQ93Lj7cDuRmnZz@qHHfoW2Htv3/b6hgwGWgYMjFZQgk4AxDhIgBmKFgAMFcIBLCBuuD8ZDYEDUQngEA "Jelly – Try It Online").
### How?
The basic idea is to insert a value, `f(left,right)`, between each neighbouring pair, `[left,right]`, of each row then to transpose, and then to repeat the same thing again (insert values, transpose).
In order to handle the diagonal requirement, we must have an `f(left,right)` that maintains the necessary information between the steps. That is, when neighbours are not equal we need to remember which one was a one during the first pass and have those values work for us during the second pass.
The code below implements `f(left,right)` as "if `left` equals `right` then yield `left` else yield the sum of each of `[left,right]`" (`ḢS€E?`). This means that the first pass can yield `[1,0]` or `[0,1]` (to be treated as `0`s in the end) in addition to `0` and `1`, and the second pass can then yield `[1,1]` too (to be treated as a `1` in the end).
```
żḢS€E?ƝẎ)Z$⁺Ạ€€ - Link: list of list of 1s and 0s, M
          $⁺    - do this twice - f(Current=M):
        )       -     for each Row in Current:
      Ɲ         -       for neighbouring pairs of elements in Row:
     ?          -         if...
    E           -         ...condition: equal?
 Ḣ              -         ...then: head
                             first pass: [0,0]->0
                                         [1,1]->1
                                              second pass: [  0  ,  0  ]->  0
                                                           [  1  ,  1  ]->  1
                                                           [[1,0],[1,0]]->[1,0]
                                                           [[0,1],[0,1]]->[0,1]
  S€            -         ...else: sum each
                             first pass: [0,1]->[0,1]
                                         [1,0]->[1,0]
                                              second pass: [  0  ,  1  ]->[0,1]
                                                           [  0  ,[0,1]]->[0,1]
                                                           [  0  ,[1,0]]->[0,1]
                                                           [  1  ,  0  ]->[1,0]
                                                           [  1  ,[0,1]]->[1,1]
                                                           [  1  ,[1,0]]->[1,1]
                                                           [[0,1],  0  ]->[1,0]
                                                           [[0,1],  1  ]->[1,1]
                                                           [[0,1],[1,0]]->[1,1]
                                                           [[1,0],  0  ]->[1,0]
                                                           [[1,0],  1  ]->[1,1]
                                                           [[1,0],[0,1]]->[1,1]
ż               -       zip Curent and those together
       Ẏ        -       tighten (flattens by one level, to counter the zip)
         Z      -     transpose
            Ạ€€ - all? for each element in each row
                  0->0  1->1  [0,1]->0  [1,0]->0  [1,1]->1
```
---
Implementing `f(left,right)` as a hash function, with Jelly's `ḥ` built-in, I've only found a 16:
```
ż⁽7&,14ḥ$ƝẎ)Z$⁺Ḃ
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 35 bytes
```
ＷＳ⊞υιＥ⊖⊗Ｌυ⭆⊖⊗Ｌθ⌈Ｅ²⌊Ｅ²§§υ⊘⁺ιπ⊘⁺λ¬⁼νπ
```
[Try it online!](https://tio.run/##hY7LCsIwEEX3/YosJxAhdduVUEHBSsEviG1oA9P0ldT@fRxTlO6cWRzmcrhM1aqp6hWG8GoNagZXO3j3cJOxDXDOSj@34AUzPEtKCh0UaoBcV5PutHW6hrz3TyTetG0cuZxzwbaCP@oY1UKtpvNd7D3Saez@PLmrrfUKX9IrF4ULlZToZzCCDbFlH6Jg997BefQKZ7Cb8psshDSVtEkqCTKRkRs@IVEm4bDgGw "Charcoal – Try It Online") Link is to verbose version of code. Takes I/O as a list of newline-terminated strings of `0`s and `1`s. Explanation:
```
ＷＳ⊞υι
```
Input the binary matrix.
```
Ｅ⊖⊗Ｌυ⭆⊖⊗Ｌθ⌈Ｅ²⌊Ｅ²§§υ⊘⁺ιπ⊘⁺λ¬⁼νπ
```
Loop over the dimensions of the expanded matrix, calculating the positions of the possible adjacent `1`s, and for each output `1` if one pair of positions is both `1`. This is equivalent to the following operations, starting with:
```
WX
YZ
```
This first gets expanded by duplication, i.e.
```
ABC WWX
DEF=WWX
GHI YYZ
```
Then for each position in the grid, two pairs of cells are checked: the cell itself and the one diagonally below right, and the cells below and to the right:
```
A -> AE | BD = WW | WW = W
B -> BF | CE = WX | XW = WX
D -> DH | EG = WY | WY = WY
E -> EI | FH = WZ | XY as desired
```
[Answer]
# [Pip](https://github.com/dloscutoff/pip) `-xP`, 25 bytes
```
{MX B*R_MPaZb}MP_WV_MaWVa
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m724ILNgebSSbkWAUuyCpaUlaboWO6t9IxSctILifQMSo5JqfQPiw8PifRPDwxIh8lBle6OVoqMNrA2tDWOtow2tDeC0QWws3CwA)
### Explanation
Port of [Neil's Charcoal answer](https://codegolf.stackexchange.com/a/245605/16766).
```
{MX B*R_MPaZb}MP_WV_MaWVa
                     a     First command-line input (eval'd as list due to -x flag)
                      WVa  Weave with itself (double each row)
                    M      Map to each row:
                _WV_         Weave with itself (double each column)
{            }MP           Map to each pair of rows:
          aZb                Zip the two rows together
        MP                   Map to each pair of [upper lower] pairs (i.e. 2x2 submatrix):
      R_                       Reverse the first pair
    B*                         Multiply itemwise by the second pair
 MX                            Maximum (1 if either product is 1, 0 otherwise)
```
]