# Error: Photoshop Error. Code: -1. When using \`imaging.getPixels\` in 16bit document

**URL:** https://forums.creativeclouddeveloper.com/t/error-photoshop-error-code-1-when-using-imaging-getpixels-in-16bit-document/9678
**Category:** Photoshop
**Created:** [February 25, 2025, 2:12pm UTC](https://forums.creativeclouddeveloper.com/t/error-photoshop-error-code-1-when-using-imaging-getpixels-in-16bit-document/9678 "2025-02-25T14:12:39Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![zombieyang](https://avatars.discourse-cdn.com/v4/letter/z/258eb7/32.png) [@zombieyang](https://forums.creativeclouddeveloper.com/u/zombieyang)
#### Post date: [February 25, 2025, 2:12pm UTC](https://forums.creativeclouddeveloper.com/t/error-photoshop-error-code-1-when-using-imaging-getpixels-in-16bit-document/9678/1 "2025-02-25T14:12:39Z")

</div>

Version: Photoshop v26.3  
Document: any 16bit document  
Key parameter of imaging.getPixels: “componentSize: 8”

Most importantly, it does works in 25.0, but 26.3 does not.

---

<div class="post-metadata">

### Author: ![Jarda](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/jarda/32/1909_2.png) [@Jarda](https://forums.creativeclouddeveloper.com/u/Jarda)
#### Post date: [March 10, 2025, 7:41am UTC](https://forums.creativeclouddeveloper.com/t/error-photoshop-error-code-1-when-using-imaging-getpixels-in-16bit-document/9678/2 "2025-03-10T07:41:22Z")

</div>

What is your code? Can you share that part?

---

<div class="post-metadata">

### Author: ![zombieyang](https://avatars.discourse-cdn.com/v4/letter/z/258eb7/32.png) [@zombieyang](https://forums.creativeclouddeveloper.com/u/zombieyang)
#### Post date: [March 12, 2025, 3:00pm UTC](https://forums.creativeclouddeveloper.com/t/error-photoshop-error-code-1-when-using-imaging-getpixels-in-16bit-document/9678/3 "2025-03-12T15:00:17Z")

</div>

> **[GitHub - zombieyang/PS\_imaging\_test](https://github.com/zombieyang/PS_imaging_test)**
>
> Contribute to zombieyang/PS\_imaging\_test development by creating an account on GitHub.

try this one. open a 16bit psd then click button  
works at 25.0 but will break in latest

---

<div class="post-metadata">

### Author: ![Jarda](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/jarda/32/1909_2.png) [@Jarda](https://forums.creativeclouddeveloper.com/u/Jarda)
#### Post date: [March 12, 2025, 7:56pm UTC](https://forums.creativeclouddeveloper.com/t/error-photoshop-error-code-1-when-using-imaging-getpixels-in-16bit-document/9678/4 "2025-03-12T19:56:17Z")

</div>

And if you set component size to 16 instead 8?

---

<div class="post-metadata">

### Author: ![zombieyang](https://avatars.discourse-cdn.com/v4/letter/z/258eb7/32.png) [@zombieyang](https://forums.creativeclouddeveloper.com/u/zombieyang)
#### Post date: [March 15, 2025, 4:02am UTC](https://forums.creativeclouddeveloper.com/t/error-photoshop-error-code-1-when-using-imaging-getpixels-in-16bit-document/9678/5 "2025-03-15T04:02:19Z")

</div>

Of course it will work.  
The thing is, if the code worked in 25.0, but broke in the latest version. I have to confirm whether it was a breaking change or a bug.  
I have already write own code to convert 16bit pixel data to 8bit pixel data.

---

<div class="post-metadata">

### Author: ![Jarda](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/jarda/32/1909_2.png) [@Jarda](https://forums.creativeclouddeveloper.com/u/Jarda)
#### Post date: [March 15, 2025, 6:47am UTC](https://forums.creativeclouddeveloper.com/t/error-photoshop-error-code-1-when-using-imaging-getpixels-in-16bit-document/9678/6 "2025-03-15T06:47:05Z")

</div>

If that worked before I believe it was a bug. Imagine you have 8bit document asking for 16bit. Where do you get those additional 50% of data from?

---

<div class="post-metadata">

### Author: ![zombieyang](https://avatars.discourse-cdn.com/v4/letter/z/258eb7/32.png) [@zombieyang](https://forums.creativeclouddeveloper.com/u/zombieyang)
#### Post date: [March 23, 2025, 1:01pm UTC](https://forums.creativeclouddeveloper.com/t/error-photoshop-error-code-1-when-using-imaging-getpixels-in-16bit-document/9678/7 "2025-03-23T13:01:20Z")

</div>

I think it can just act like that when I change the document mode from 8bit to 16bit in photoshop.

---

<div class="post-metadata">

### Author: ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)
#### Post date: [March 23, 2025, 1:10pm UTC](https://forums.creativeclouddeveloper.com/t/error-photoshop-error-code-1-when-using-imaging-getpixels-in-16bit-document/9678/8 "2025-03-23T13:10:27Z")

</div>

You should probably check for mode before geting pixels

---

<div class="post-metadata">

### Author: ![zombieyang](https://avatars.discourse-cdn.com/v4/letter/z/258eb7/32.png) [@zombieyang](https://forums.creativeclouddeveloper.com/u/zombieyang)
#### Post date: [March 23, 2025, 1:11pm UTC](https://forums.creativeclouddeveloper.com/t/error-photoshop-error-code-1-when-using-imaging-getpixels-in-16bit-document/9678/9 "2025-03-23T13:11:55Z")

</div>

If the only option for “componentSize” is to pass the current doc’s componentSize to it.

Why was this option designed? I think Photoshop can just get the current componentSize inside the API.
