简体   繁体   English

如何通过 Google Sheets 中的 Url 获取图像的宽度和高度

[英]How to get the width and height of an image by Url in Google Sheets

I have in a Google Sheet a list of images by URL.我在 Google Sheet 中有一个按 URL 列出的图像列表。 Images are on a remote server.图像位于远程服务器上。 I got the preview in my Sheet by the Image (URL) function.我通过图像 (URL) 功能在我的工作表中获得了预览。

Is there a way to get the width and height of each remote image in each row by formula or script?有没有办法通过公式或脚本获取每行中每个远程图像的宽度和高度?

示例

Looking through the Google Community docs, found this question asked here with no apparent solution.查看谷歌社区文档,发现这里提出的这个问题没有明显的解决方案。

It's not exactly what you're looking for, but you could use the IMAGE function to set the dimensions your images.这并不完全是您要查找的内容,但您可以使用IMAGE函数来设置IMAGE的尺寸。

IMAGE(url, [mode], [height], [width])图像(网址,[模式],[高度],[宽度])

url - The URL of the image, including protocol (eg http://). url - 图像的 URL,包括协议(例如 http://)。

The value for url must either be enclosed in quotation marks or be a reference to a cell containing the appropriate text. url 的值必须用引号括起来,或者是对包含适当文本的单元格的引用。 mode - [ OPTIONAL - 1 by default ] - The sizing mode for the image模式 - [ 可选 - 默认为 1 ] - 图像的大小调整模式

1 resizes the image to fit inside the cell, maintaining aspect ratio. 1 调整图像大小以适应单元格,保持纵横比。

2 stretches or compresses the image to fit inside the cell, ignoring aspect ratio. 2 拉伸或压缩图像以适应单元格,忽略纵横比。

3 leaves the image at original size, which may cause cropping. 3 使图像保持原始大小,这可能会导致裁剪。

4 allows the specification of a custom size. 4 允许自定义尺寸的规格。

Note that no mode causes the cell to be resized to fit the image.请注意,没有任何模式会导致单元格调整大小以适合图像。

height - [ OPTIONAL ] - The height of the image in pixels.高度 - [ 可选 ] - 图像的高度(以像素为单位)。 mode must be set to 4 in order to set a custom height. mode 必须设置为 4 才能设置自定义高度。

width - [ OPTIONAL ] - The width of the image in pixels.宽度 - [ 可选 ] - 图像的宽度(以像素为单位)。 mode must be set to 4 in order to set a custom width. mode 必须设置为 4 才能设置自定义宽度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从 Google Sheets API 获取“单元格中的图像”URL - How to get an "Image in cell" URL from the Google Sheets API 使用 IMPORTXML Google 表格获取图像 URL - Get Image URL Using IMPORTXML Google Sheets 如何根据 Google 表格中图像的 URL 进行过滤? - How to filter based on the URL of an image in Google Sheets? 如何以编程方式在Google表格中获取图形作为图像 - How to programmatically get a graph in Google Sheets as an image 如何在 Google 表格中显示来自 URL 的图像? (并将其应用于多行) - How to display Image from URL in Google Sheets? (and apply it to multiple rows) 谷歌表格图像网址到单元格中的图像? - Google sheets image url to image in cell? 用于减小字体大小以适应 Google 表格中的单元格宽度(和高度)的脚本 - Script to reduce font size to fit cell width (and height) in Google Sheets Google表格通过ARRAYFORMULA将可变宽度/高度表转换为列表 - Google Sheets transform variable width/height sheet into list with ARRAYFORMULA 设置 Google Sheets 文件中每个图表的高度和宽度 - Set height and width of every chart in Google Sheets file 如何从Google表格中的URL获取页面标题? - How to get page title from URL in Google Sheets?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM