The correct way to do this is, I think, to define a custom shading which may be used to either shade the rectangle directly or to create a fading.
However, whether the following example is a correct way to define a custom shading, I'm not sure. I've only created custom radial shadings in the past and they always confuse me!
Caveat emptor!
Note that only the centre quarter of a shading is shown when it is used to fill a rectangle and that shadings for normal use should be 100x100 bp
. Hence, the custom shading starts in practice at 25 bp
and finishes at 75 bp
. I've used plausible colours for the two extreme ends (which might be displayed in some cases of rotation etc.), but these may require tweaking if this is a consideration.
\documentclass[border=10pt,multi,tikz]{standalone}
\usetikzlibrary{fadings}
\pgfdeclarehorizontalshading[f0col,f1col,f2col,f3col,f4col,f5col]{special shading}{100bp}{%
color(0bp)=(f0col);
color(25bp)=(f1col);
color(30bp)=(f2col);
color(50bp)=(f3col);
color(72bp)=(f4col);
color(75bp)=(f5col);
color(100bp)=(f5col)
}
\tikzset{%
special colour 0/.code={%
\colorlet{f0col}{#1}%
},
special colour 1/.code={%
\colorlet{f1col}{#1}%
},
special colour 2/.code={%
\colorlet{f2col}{#1}%
},
special colour 3/.code={%
\colorlet{f3col}{#1}%
},
special colour 4/.code={%
\colorlet{f4col}{#1}%
},
special colour 5/.code={%
\colorlet{f5col}{#1}%
},
special colours/.style args={#1,#2,#3,#4,#5,#6}{%
special colour 0=#1,
special colour 1=#2,
special colour 2=#3,
special colour 3=#4,
special colour 4=#5,
special colour 5=#6,
},
special colours={black!0,black!60,black!5,black!5,black!70,black!100},
special shading/.style={%
shading=special shading,
},
}
\tikzfading[name=special fading, special shading, special colours={transparent!0,transparent!60,transparent!5,transparent!5,transparent!70,transparent!100}]
\begin{document}
\begin{tikzpicture}
\fill \foreach \i in {-.3,.3,...,1.6} {(0,\i) rectangle +(1,.3)};
\path [special shading] (0,0) rectangle (1,-.3);
\path [special shading, special colour 2=red] (0,.3) rectangle +(1,.3);
\path [special shading, special colours={red,orange,yellow,green,blue,purple,violet}] (0,.9) rectangle +(1,.3);
\fill [path fading=special fading, white] (0,1.5) rectangle +(1,.3);
\draw [thick] \foreach \i in {-.3,.3,...,1.6} {(0,\i) rectangle +(1,.3)};
\end{tikzpicture}
\end{document}
Here's the result. The top rectangle uses the shading to create a fading which fades the white overlaying the black as in the question. The bottom shading fills the rectangle directly. The two shadings in the middle illustrate ways in which one or more or all colours may be customised. (This is also used with the transparent
colour, of course, when creating the fading.)

I cannot tell the difference between this and the result produced by the OP because I could not see the original flaw even zoomed to the maximum 1,600%. However, since this uses a closed path to fill, I am assuming that it should avoid the problem entirely.
standalone
package. Thenincludegraphics
the raster image.