[b01lers2020]image

[b01lers2020]image,第1张

PS打开:

注意到每一像素列都会有红色,有的既有红色还有黑色(灰色);还注意到红色的条纹长度是一样的(11像素),依据红色条纹对齐每一像素列:

import cv2
from PIL import Image
import numpy as np

img = cv2.imread('attachment.png')
flag = np.array([[255]*1500]*200,np.uint8)

for col in range(1500):		# 对每一列进行处理
    for i in range(200):	# 遍历一列中的像素,找到 白(255,255,255) 红(0,0,255) 相间的索引值(通道顺序:BGR)
        if img[i-1,col,0]==255 and img[i,col,0]==0 and img[i,col,2]==255:
            for j in range(200):
                flag[(j+(189-i))%200,col] = img[j,col,0]	# 这个地方的算法自己体会吧

Image.fromarray(flag).save('flag.bmp')

flag{ShuFfLiNg_Fl4gs}

图像题一定动手写代码,把大牛的脚本吃透了,都万变不离其宗啊。


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/570830.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-09
下一篇 2022-04-09

发表评论

登录后才能评论

评论列表(0条)

保存