.ppm 镜像镜像是颠倒的和低质量的

问题描述

我有一个应该镜像 <!DOCTYPE html> <html lang="en"> <head> <Meta charset="UTF-8"> <Meta http-equiv="X-UA-Compatible" content="IE=edge"> <Meta name="viewport" content="width=device-width,initial-scale=1.0"> <title>Simple Landing Page FlexBox Layout With Navbar Full Height Content And Footer Sticky To The Bottom</title> </head> <body> <div class="app wrapper"> <div class="navbar"> Navbar </div> <div class="content"> <h1>Content</h1> <h2>Takes remaining height and grows if needed!</h2> </div> <footer class="footer"> Footer </footer> </div> </body> </html> 图像的程序。

然而,它会产生一个颠倒的镜像。如何防止它翻转图像?

代码

.ppm

输入:

enter image description here

预期输出

enter image description here

我得到了什么:

enter image description here

解决方法

好吧,横向镜像也是镜像。 :-)

您似乎假设输入文件中的每一行像素都有一行。这是危险的;不能保证会是这种情况。

无论如何,如果您的假设成立,那么 lists 将包含每一行的三元组列表。然后颠倒这些列表的顺序,而不是颠倒每行中三元组的顺序!