# Check if image has transparency?

**URL:** <https://forums.creativeclouddeveloper.com/t/check-if-image-has-transparency/1289>\
**Category:** UXP Plugin API\
**Tags:** api-feedback\
**Created:** [October 7, 2019, 5:11pm UTC](https://forums.creativeclouddeveloper.com/t/check-if-image-has-transparency/1289 "2019-10-07T17:11:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Velara](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/velara/32/1278_2.png) [@Velara](https://forums.creativeclouddeveloper.com/u/Velara)\
**Post date:** [October 7, 2019, 5:11pm UTC](https://forums.creativeclouddeveloper.com/t/check-if-image-has-transparency/1289/1 "2019-10-07T17:11:42Z")

</div>

I’m exporting to PNG and I noticed I can reduce the file size if I use JPEG. But JPEG doesn’t support transparency so it’s safer to export to PNG.

Is there a way to check if an image has transparency?

Does PNG support compression?

> **[application · Adobe XD Plugin Reference](https://adobexdplatform.com/plugin-docs/reference/application.html#applicationcreaterenditionsrenditions)**

---

<div class="post-metadata">

**Author:** ![cpryland](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/cpryland/32/1172_2.png) [@cpryland](https://forums.creativeclouddeveloper.com/u/cpryland)\
**Post date:** [October 7, 2019, 6:47pm UTC](https://forums.creativeclouddeveloper.com/t/check-if-image-has-transparency/1289/2 "2019-10-07T18:47:29Z")

</div>

First google result of “does png support compression”:

> **[JPEG vs. PNG: Which compressed image format is better? | Digital Trends](https://www.digitaltrends.com/computing/jpeg-vs-png/)**
>
> JPEG vs. PNG: Which is better? There are many differences between each format that make each better in certain situations. Learn more to determine what's best.

---

<div class="post-metadata">

**Author:** ![Velara](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/velara/32/1278_2.png) [@Velara](https://forums.creativeclouddeveloper.com/u/Velara)\
**Post date:** [October 7, 2019, 7:22pm UTC](https://forums.creativeclouddeveloper.com/t/check-if-image-has-transparency/1289/3 "2019-10-07T19:22:20Z")

</div>

Let me rephrase that.

Does PNG support a compression quality option during export of renditions in XD? I know it would be lossy.

From the [docs](https://adobexdplatform.com/plugin-docs/reference/application.html#applicationcreaterenditionsrenditions) it appears the quality option is only for JPEGs:

> **quality** number _(JPG renditions)_ Compression quality in the range [1, 100].

> **background**?Color _(PNG & JPEG renditions)_ Alpha component ignored for JPG. Optional: defaults to transparent for PNG, solid white for JPG.

Or does JPEG export type support transparency? There are newer JPEG formats like JPEG XR that say they support transparency.

> **Transparency map support**  
> An [alpha channel](https://en.wikipedia.org/wiki/Alpha_compositing) may be present to represent transparency, so that alpha blending overlay capability is enabled. [JPEG XR - Wikipedia](https://en.wikipedia.org/wiki/JPEG_XR)

In my case I was thinking I’ll export JPEG if the image doesn’t have transparency and export PNG if it does.

---

<div class="post-metadata">

**Author:** ![cpryland](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/cpryland/32/1172_2.png) [@cpryland](https://forums.creativeclouddeveloper.com/u/cpryland)\
**Post date:** [October 7, 2019, 7:59pm UTC](https://forums.creativeclouddeveloper.com/t/check-if-image-has-transparency/1289/4 "2019-10-07T19:59:18Z")

</div>

Given that PNG uses a lossless compression, quality settings don’t apply (in theory).

(Though people have worked out hacky compressed versions that still unzip properly, I don’t think that’s part of the standard.)

---

<div class="post-metadata">

**Author:** ![wzad](https://avatars.discourse-cdn.com/v4/letter/w/e8c25b/32.png) [@wzad](https://forums.creativeclouddeveloper.com/u/wzad)\
**Post date:** [October 11, 2019, 4:21pm UTC](https://forums.creativeclouddeveloper.com/t/check-if-image-has-transparency/1289/5 "2019-10-11T16:21:44Z")

</div>

I would guess not.  
Any png I’ve ever exported from any adobe software Is always much larger In size than Png’s compressed through tools like [https://compresspng.com/](https://compresspng.com/)

So I would presume compression on PNG is not something adobe has ever built in

---

<div class="post-metadata">

**Author:** ![Velara](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/velara/32/1278_2.png) [@Velara](https://forums.creativeclouddeveloper.com/u/Velara)\
**Post date:** [October 11, 2019, 5:14pm UTC](https://forums.creativeclouddeveloper.com/t/check-if-image-has-transparency/1289/6 "2019-10-11T17:14:49Z")

</div>

Interesting… thanks. I used the Image Optimize plugin and it helped some. I’d like to see it add some more options but haven’t followed up on that. In my case I have a large image and want more compression.

**[Compresspng.com](http://Compresspng.com)** reduced the size by 66%. _The image was almost too compressed._  
**Image Optimizer** reduced the size by 18%.

---

<div class="post-metadata">

**Author:** ![cpryland](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/cpryland/32/1172_2.png) [@cpryland](https://forums.creativeclouddeveloper.com/u/cpryland)\
**Post date:** [October 11, 2019, 5:30pm UTC](https://forums.creativeclouddeveloper.com/t/check-if-image-has-transparency/1289/7 "2019-10-11T17:30:35Z")

</div>

I assume these compressors compromise quality at higher (non-standard) compression, just like JPEG.

---

<div class="post-metadata">

**Author:** ![Velara](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/velara/32/1278_2.png) [@Velara](https://forums.creativeclouddeveloper.com/u/Velara)\
**Post date:** [October 11, 2019, 5:31pm UTC](https://forums.creativeclouddeveloper.com/t/check-if-image-has-transparency/1289/8 "2019-10-11T17:31:20Z")

</div>

Yes. I’m looking for the Goldilocks compressed amount.
