<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">The new Cairo backend flips the <code class="notranslate">imshow</code> image compared to the Agg.</p>
<p dir="auto"><strong>Code</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import matplotlib
matplotlib.use(&quot;TkCairo&quot;) # or matplotlib.use(&quot;TkAgg&quot;)
import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(4,2.5))

im = plt.imread(&quot;house.png&quot;)
ax.imshow(im, origin=&quot;upper&quot;)

fig.suptitle(matplotlib.get_backend())
fig.savefig(matplotlib.get_backend()+&quot;.png&quot;)
plt.show()
"><pre class="notranslate"><code class="notranslate">import matplotlib
matplotlib.use("TkCairo") # or matplotlib.use("TkAgg")
import matplotlib.pyplot as plt

fig, ax = plt.subplots(figsize=(4,2.5))

im = plt.imread("house.png")
ax.imshow(im, origin="upper")

fig.suptitle(matplotlib.get_backend())
fig.savefig(matplotlib.get_backend()+".png")
plt.show()

</code></pre></div>
<p dir="auto"><strong>Actual outcome: TkAgg (similar with Qt4Agg)</strong></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/23121882/37560576-6d5930b4-2a3b-11e8-884d-0d59f78d997b.png"><img src="https://user-images.githubusercontent.com/23121882/37560576-6d5930b4-2a3b-11e8-884d-0d59f78d997b.png" alt="tkagg" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Actual outcome: TkCairo (similar with Qt4Cairo)</strong></p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/23121882/37560579-71fa8cd0-2a3b-11e8-8472-1b52d6c11a49.png"><img src="https://user-images.githubusercontent.com/23121882/37560579-71fa8cd0-2a3b-11e8-8472-1b52d6c11a49.png" alt="tkcairo" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto">I would guess the Agg behaviour is the intended one.</p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: Windows 8.1</li>
<li>Matplotlib version: 2.2</li>
<li>Matplotlib backend:  TkCairo, Qt4Cairo (flipped image); TkAgg, Qt4Agg (upright image)</li>
<li>Python version: 2.7.10</li>
</ul>
<p dir="auto">As of master (and probably since a long time)</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="from pylab import *
rcdefaults()
fig, axs = plt.subplots(1, 2)
axs[0].imshow(np.arange(4).reshape((2, 2)))
axs[1].imshow(np.arange(4).reshape((2, 2)), alpha=.5)
show()"><pre class="notranslate"><code class="notranslate">from pylab import *
rcdefaults()
fig, axs = plt.subplots(1, 2)
axs[0].imshow(np.arange(4).reshape((2, 2)))
axs[1].imshow(np.arange(4).reshape((2, 2)), alpha=.5)
show()
</code></pre></div>
<p dir="auto">produces, on gtk3agg<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1322974/27520067-b15eda8a-59b6-11e7-9eb0-7c98645bb850.png"><img src="https://user-images.githubusercontent.com/1322974/27520067-b15eda8a-59b6-11e7-9eb0-7c98645bb850.png" alt="gtk3agg" style="max-width: 100%;"></a><br>
and on gtk3cairo<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/1322974/27520068-b7c9934c-59b6-11e7-9e15-462c0ad173a7.png"><img src="https://user-images.githubusercontent.com/1322974/27520068-b7c9934c-59b6-11e7-9e15-462c0ad173a7.png" alt="gtk3cairo" style="max-width: 100%;"></a></p>
<p dir="auto">Looks like image.origin is not respected, and alpha is not applied correctly (this is not surprising, as cairo uses <em>premultiplied</em> ARGB (<a href="https://www.cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t" rel="nofollow">https://www.cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t</a> CAIRO_FORMAT_ARGB32).</p>