纯文本GIF分辨率 [英] Plain text GIF resolution

查看:123
本文介绍了纯文本GIF分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗯,问题是在Linux中使用终端我使用nano来创建内容为GIF89a2017的纯文本文件,并将其保存为 稀有 和我知道由于该标题,文件被检测为GIF图像。问题是我在标题旁边放了四个字节,在这种情况下,2017给出了分辨率。这样,当我执行命令 文件罕见 时,它输出: rare.gif:GIF图像数据,版本89a,12338 x 14129



我的尝试:



我知道这四个字节是一些无符号的16位整数但我不知道如何将20转换为0x3032和17转换为0x3731。这样你就得到了分辨率,但我不知道你是如何得到它的,对我而言似乎只是增加了一个。



感谢所有人!

Well, the thing is that in Linux with the Terminal I use nano to create a plain text file with the content "GIF89a2017" and I save it as rare and I know that due to that header the file is detected as a GIF image. The thing is that four bytes that I put next to the header, 2017 in this case, give the resolution. That way when I do the command file rare it outputs: rare.gif: GIF image data, version 89a, 12338 x 14129.

What I have tried:

I know that those four bytes are some unsigned 16-bit integers but I don't know how it is done to convert 20 into 0x3032 and 17 into 0x3731. That way you get the resolution but I don't know how you get it, to me it just seems like a 3 is added.

Thanks to everyone!

推荐答案

0x3032是存储在短片中的字符'02'的十六进制表示。并且(假设这是在x86系统上)当被称为字节时,实际上将被视为两个字符'20'。类似地,0x3731是正常顺序的字符71或17。



要将这两个值存储为整数,您需要将20作为十六进制0x0014)和17作为十六进制0x0011 。所以你的标题必须是GIF89a \ x00 \ x14 \ x00 \ x11;其中\ x前缀表示绝对十六进制值而不是四个字符\ x00等。但是您希望如何使用文本编辑器创建GIF图像是您可能会发现更具挑战性的事情。
0x3032 is the hex representation of the characters '02' stored in a short. And (assuming this is on an x86 system) that will actually be seen as the two characters '20' when addressed as bytes. Similarly 0x3731 is the characters 71, or 17 in normal order.

To store those two values as integers you need to put 20 as hex 0x0014) and 17 as hex 0x0011. So your header needs to be "GIF89a\x00\x14\x00\x11"; where the \x prefix indicates an absolute hex value not the four character \x00 etc.. But quite how you expect to create a GIF image with a text editor is something that you may find even more challenging.


这篇关于纯文本GIF分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆