One way is from here:
julia> using Pkg; pkg"add ImageFiltering"
julia> using ImageFiltering
julia> arr = reshape(1:6, (2,3))
2×3 reshape(::UnitRange{Int64}, 2, 3) with eltype Int64:
1 3 5
2 4 6
julia> BorderArray(arr, Pad((1,1)))
4×5 BorderArray{Int64,2,Base.ReshapedArray{Int64,2,UnitRange{Int64},Tuple{}},Pad{2}} with indices 0:3×0:4:
1 1 3 5 5
1 1 3 5 5
2 2 4 6 6
2 2 4 6 6
Note that this won’t in general agree with the result of repeat, e.g.:
julia> repeat(arr, inner=[2,2])
4×6 Array{Int64,2}:
1 1 3 3 5 5
1 1 3 3 5 5
2 2 4 4 6 6
2 2 4 4 6 6
Note also that for padding with a constant, but not with the edge values, there is GitHub - JuliaArrays/PaddedViews.jl: Add virtual padding to the edges of an array