# How to get from selection pixels value instead of point units

**URL:** <https://forums.creativeclouddeveloper.com/t/how-to-get-from-selection-pixels-value-instead-of-point-units/6407>\
**Category:** UXP Plugin API\
**Created:** [June 17, 2023, 1:27pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-from-selection-pixels-value-instead-of-point-units/6407 "2023-06-17T13:27:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![HimagenesPrint](https://avatars.discourse-cdn.com/v4/letter/h/73ab20/32.png) [@HimagenesPrint](https://forums.creativeclouddeveloper.com/u/HimagenesPrint)\
**Post date:** [June 17, 2023, 1:27pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-from-selection-pixels-value-instead-of-point-units/6407/1 "2023-06-17T13:27:13Z")

</div>

When I capture these values ​​they come in unit point - how can I get the value converted to pixels from that same result when making a selection? or can i get the selection value in pixels not in unit points

set  
{\_target: Array(1), to: {…}, \_isCommand: true}  
to:  
bottom:  
\_unit: “distanceUnit”  
\_value: 1382.3999999999999  
[[Prototype]]: Object  
left:  
\_unit: “distanceUnit”  
\_value: 0  
[[Prototype]]: Object  
right:  
\_unit: “distanceUnit”  
\_value: 921.5999999999999  
[[Prototype]]: Object  
top:  
\_unit: “distanceUnit”  
\_value: 0  
[[Prototype]]: Object  
\_obj: “rectangle”

---

<div class="post-metadata">

**Author:** ![PatrickDeen](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/patrickdeen/32/1263_2.png) [@PatrickDeen](https://forums.creativeclouddeveloper.com/u/PatrickDeen)\
**Post date:** [June 19, 2023, 8:39am UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-from-selection-pixels-value-instead-of-point-units/6407/2 "2023-06-19T08:39:24Z")

</div>

I think the units are to be based on the user’s preference.  
You could check your preference settings.

_If I’m right you should be able to get the preference settings, change the units to pixel if necessary, get the data you need (in pixels) and change the preference back to the original settings._

---

<div class="post-metadata">

**Author:** ![PS-fxrios](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/ps-fxrios/32/2461_2.png) [@PS-fxrios](https://forums.creativeclouddeveloper.com/u/PS-fxrios)\
**Post date:** [June 19, 2023, 7:27pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-from-selection-pixels-value-instead-of-point-units/6407/3 "2023-06-19T19:27:10Z")

</div>

Have you tried replacing:

```auto
_unit: “distanceUnit”   
Per:
_unit: "pixelsUnit"

```

---

<div class="post-metadata">

**Author:** ![HimagenesPrint](https://avatars.discourse-cdn.com/v4/letter/h/73ab20/32.png) [@HimagenesPrint](https://forums.creativeclouddeveloper.com/u/HimagenesPrint)\
**Post date:** [June 22, 2023, 12:48pm UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-from-selection-pixels-value-instead-of-point-units/6407/4 "2023-06-22T12:48:16Z")

</div>

Thanks but I change the rule to pixels and get unipixels value.

---

<div class="post-metadata">

**Author:** ![DavideBarranca](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/davidebarranca/32/1523_2.png) [@DavideBarranca](https://forums.creativeclouddeveloper.com/u/DavideBarranca)\
**Post date:** [June 26, 2023, 9:37am UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-from-selection-pixels-value-instead-of-point-units/6407/5 "2023-06-26T09:37:57Z")

</div>

Jarda and I have been working on the Selection API in the past months, hopefully it’ll be released soon (ish).

---

<div class="post-metadata">

**Author:** ![HimagenesPrint](https://avatars.discourse-cdn.com/v4/letter/h/73ab20/32.png) [@HimagenesPrint](https://forums.creativeclouddeveloper.com/u/HimagenesPrint)\
**Post date:** [June 27, 2023, 11:23am UTC](https://forums.creativeclouddeveloper.com/t/how-to-get-from-selection-pixels-value-instead-of-point-units/6407/6 "2023-06-27T11:23:01Z")

</div>

ok. thanks for a better help
