# Get image size (pixels) by a url

**URL:** <https://forum.inductiveautomation.com/t/get-image-size-pixels-by-a-url/50643>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [September 6, 2021, 4:11pm UTC](https://forum.inductiveautomation.com/t/get-image-size-pixels-by-a-url/50643 "2021-09-06T16:11:35Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [September 7, 2021, 3:38pm UTC](https://forum.inductiveautomation.com/t/get-image-size-pixels-by-a-url/50643/2 "2021-09-07T15:38:25Z")

</div>

Image size is going to depend on format, so you'd have to actually load the image via some existing mechanism (e.g. Java's [`ImageIO`](https://docs.oracle.com/javase/7/docs/api/javax/imageio/ImageIO.html) class). That's going to be slow and probably more trouble than it's worth.

If your image is in image management, we do store metadata along with the image record, but we don't expose any easy way to retrieve it. See these threads for how to access the `ImageManager` object on the gateway:

> [@Get List of All Images in Folder](https://forum.inductiveautomation.com/t/get-list-of-all-images-in-folder/24440/2):
>
> You need to call ImageManager#getImages(\<folder\>), from the gateway scope. [http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/com/inductiveautomation/ignition/gateway/images/ImageManager.html](http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/com/inductiveautomation/ignition/gateway/images/ImageManager.html) Unfortunately, you will 1. have to be in the gateway scope and 2. have access to the shared ‘gateway context’ object. If you’re in the designer, you can “cheat” a bit, and use [DTGatewayInterface.getInstance().getImageList(\<component\>, \<path\>)](http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/com/inductiveautomation/ignition/designer/gateway/DTGatewayInterface.html) - but this won’t work in the client.

> [@How to save the uploaded file in default image folder (/system/images/)?](https://forum.inductiveautomation.com/t/how-to-save-the-uploaded-file-in-default-image-folder-system-images/32771/2):
>
> This won’t work the way you’re expecting it to. The /system/images/ route handler isn’t attached to an actual folder in the gateway install directory - it’s handled entirely in code, and retrieves images from the internal database. If you want to manually upload images, you’ll need to get a reference to the ImageManager on the gateway and call insertImage manually, filling in all the appropriate fields: [com.inductiveautomation.ignition.gateway.images.ImageManager#insertImage](http://files.inductiveautomation.com/sdk/javadoc/ignition79/795/com/inductiveautomation/ignition/gateway/images/ImageManager.html#insertImage-java.lang.String-java.lang.String-com.inductiveautomation.ignition.gateway.images.ImageFormat-java.lang.String-byte:A-int-int-int-). Actually doing so …

Once you've got an [`ImageRecord`](https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.8/com/inductiveautomation/ignition/gateway/images/ImageRecord.html), you can ask the record for its width and height.

---

_[View the full topic](https://forum.inductiveautomation.com/t/get-image-size-pixels-by-a-url/50643)._
