- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个包含像素值的 Excel 文件,我正在尝试将其转换为 TIFF 或栅格数据集以使用 Arcgis 打开。我在这里寻找类似的问题,但找不到任何问题。我尝试了一些东西,但它给出了一个错误。从 DEM
获取的 Excel 文件包含 2098 行 x 2851 列
,无标题。
这是我的代码:
import pandas as pd
import Image as im
file = r'C:/Users/owrasa/PycharmProjects/den/demrep2.xlsx'
size = 2098, 2851
df = pd.read_excel(file, header=0)
df2 = pd.np.array(df)
imarray = im.fromarray(df2)
imsave = im.SAVE(imarray, "TIFF")
这是错误消息:
TypeError: Cannot handle this data type
Excel 文件如下所示:
-32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767
-32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767
-32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767
-32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 60
-32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 60 60
-32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 60 60 60
-32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 60 60 60 60
-32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 60 60 60 60 60
-32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 60 60 60 60 60 60
-32767 -32767 -32767 -32767 -32767 -32767 -32767 -32767 60 60 60 60 60 60 60
-32767 -32767 -32767 -32767 -32767 -32767 -32767 60 60 60 60 60 60 60 60
-32767 -32767 -32767 -32767 -32767 -32767 60 60 60 60 60 60 60 60 60
-32767 -32767 -32767 -32767 60 60 60 60 60 60 60 60 60 60 60
-32767 -32767 -32767 60 60 60 60 60 60 60 60 60 60 60 60
-32767 -32767 59 60 60 60 60 60 60 60 60 60 60 60 60
-32767 59 59 59 59 60 60 60 60 60 60 60 60 60 60
59 59 59 59 59 59 59 59 59 60 60 60 59 60 60
59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
59 59 59 59 59 59 59 59 59 59 59 59 59 59 59
最佳答案
您的代码有几个问题:
Image
模块未从 PIL
导入。df2
的数据类型是 int64
而不是 int32
。Image.save()
的调用不正确(函数名称必须小写)。以下代码片段修复了所有这些问题,应该可以完成工作:
import pandas as pd
import numpy as np
import PIL.Image as im
file = r'C:/Users/owrasa/PycharmProjects/den/demrep2.xlsx'
df = pd.read_excel(file, header=0)
df2 = pd.np.array(df).astype(np.int32)
imarray = im.fromarray(df2)
imarray.save(r'C:/Users/owrasa/PycharmProjects/den/demrep2.tif')
关于python - 将 Excel 转换为 TIFF 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41076811/
在我们用 ASP .NET 构建的 Web 应用程序中,需要允许用户查看 TIFF 图像文件,但不能打印、保存或复制这些文档。我们了解用户可能会打印屏幕,因此没有任何解决方案是 100% 万无一失的。
我有存储 TIFF 图像的旧 Eastman/eiStream/OpenText 文档库。 部分 TIFF 带有注释,注释存储在 TIFF 头中;这些我可以找到 TIFF 标题布局的规范和注释本身的布
并非所有图像阅读器都支持 BigTIFF,我想根据文件的 TIFF 格式识别文件。如何确定现有 tiff 文件是以标准 TIFF 格式编写的,还是使用 BigTIFF 格式编写的? 最佳答案 pyth
我使用 FreeImage 处理多页 TIFF 文件,有时我在 FIBITMAP 中有一个 TIFF 页面,我需要知道它的压缩情况。知道如何做到这一点吗? 最佳答案 FreeImage 没有内置函数来
我在目录 c:\temp 中有 600 个 TIFF 文件。 文件名如下: 001_1.tif, 001_2.tif, 001_3.tif 002_1.tif, 002_2.tif, 002_3.ti
我正在使用 netbeans 平台用 java 制作 DesktopApp。在我的应用程序中,我使用 16 位、tiff、灰度图像并对该图像进行处理。现在,我想使用 16 位、tiff、灰度图像(或
在我的场景中,我有 3 个或更多的多页 tiff 图像,我需要将它们合并成一个 tiff 图像。 下面是我试过的代码。它合并到单个 tiff 图像中,但仅与所有 tiff 图像的第一页合并。 priv
我想在选定的点添加图像的温度数据。它是否有任何预定义的属性,或者我们是否可以在 Tiff 文件中创建自定义/私钥来存储图像的温度数据。 回答: 使用 TIFF 库文档在 TIFF 文件中创建您自己的自
我已经编写了多个程序变体。该程序的目的是将“任何文件类型”转换为该文件的 TIFF 图像表示形式,就像使用打印机打印一样。 我目前正在使用我向其发送文件的第三方打印机驱动程序,它输出一个 TIFF 图
我在 Windows 7 32/64 位上使用 VS2008。 我正在尝试使用 IPP 处理 tiff 图像。我做了一些搜索,但没有发现英特尔 IPP 加载 tiff 图像的任何可能性。所以我使用 l
这是我用来从输入元素加载文件的 JavaScript 代码。图片格式包括jpeg、png、tiff。 $(document).ready(function() { FileDetails = fu
我正在使用 c++ JUCE 库学习 gui 编程。该库支持图像文件格式(png、jpg)。但我想了解如何使用其他文件格式,例如 tiff。 在谷歌之后我得到了 libtiff。 我的问题是显示它的准
我正在使用 urlmon.dll 中的 FindMimeFromData 来嗅探上传文件的 MIME 类型。根据MIME Type Detection in Internet Explorer , i
我发现,通过谷歌,很多人问同样的问题,但没有解决方案。 Python 图像库 (PIL) 具有用于单步执行现有多页 TIFF 的工具,但没有创建它们的工具。 库有望在 Windows 上可用,适用于
我正在尝试使用 iText 7.1.1 将 TIFF 图像转换为具有多页的 PDF 文件。感谢那些让我开始阅读这篇文章的人 Create PDF from TIFF image using iText
在本节中,我将头文件添加到 tiff 文件的顶部。 echo "/CourierLatin1 findfont 8 scalefont setfont" >>${PS} echo "40 2 move
对于 OCR 引擎,我需要为 OCR 引擎提供带有 CCITT4 压缩的 TIFF 文件。我们的扫描仪输出 JPEG 压缩的 TIFF 文件。我想用 C# 转换这些文件,使用 System.Drawi
我有 5 个单页 tiff 图像。我想将所有这 5 张 tiff 图像组合成一张多页 tiff 图像。我正在使用 Java 高级成像 API。看了SUN给的JAI API文档和教程。我是 JAI 的新
我需要一个 C# 函数,它将采用 8 位灰度 TIFF 的 Byte[],并返回 1 位(黑白)TIFF 的 Byte[]。 我对使用 TIFF 还很陌生,但一般的想法是我们需要将它们从灰度或彩色转换
我想在 TIFF 文件中操作 RGB 波段并在 matplotlib 上输出 灰度 贴图。到目前为止我有这段代码,但我无法在灰度上得到它: import scipy as N import gdal
我是一名优秀的程序员,十分优秀!