Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PNG with Alpha Channel does not import / replace properly #85

Open
thetrebor opened this issue Sep 12, 2018 · 6 comments
Open

PNG with Alpha Channel does not import / replace properly #85

thetrebor opened this issue Sep 12, 2018 · 6 comments

Comments

@thetrebor
Copy link

000000no-alpha
000000

Steps to reproduce:
Import or replace a bitmap slice with a PNG image that has an alpha channel: notice that the image is imported as all-black.
Import or replace a bitmap slice with a PNG image that has NO alpha channel: notice it appears correctly.

Desired behavior:
Images import irregardless if PNG alpha channel is present.

@NardJ
Copy link
Collaborator

NardJ commented Sep 14, 2018

Thx, will look into this!

@thetrebor
Copy link
Author

I looked at the code to see if could do it by nudging some arguments but, alas, it's beyond my skill.

@daef
Copy link

daef commented Sep 12, 2019

https://github.com/Photonsters/PhotonFileEditor/blob/release/PhotonFile.py#L467 seems to read alpha and discard the value... maybe the order of the tuple is ARGB instead of RGBA

@daef
Copy link

daef commented Sep 12, 2019

I got it working with an rgba image (generated via inkscape), I just had to use white for bg and black for exposed: example

@krummrey
Copy link

I'm trying to get to load files from Photoshop back in. As I understand it the PNGs need to be 32bit (24 RGB and 8 Alpha). I used ImageMagik to convert 2 bit pngs to 32 bit:
ls *.png | xargs -I% convert % png32:%
The results seem to be correct:
magick identify slice__0029.png
slice__0029.png PNG 1440x2560 1440x2560+0+0 8-bit sRGB 105243B 0.000u 0:00.000
Still I can't reimport the images back in.
Stored: {'Action': 'replace', 'LayerNr': 0, 'LayerDef': {'Layer height (mm)': b'\xcd\xccL=', 'Exp. time (s)': b'\x00\x00HB', 'Off time (s)': b'\x00\x00\x00\x00', 'Image Address': b'\xd5\x1f\x00\x00', 'Data Length': b'\xe3\x81\x00\x00', 'padding': b'\x00\x00\x00\x00T\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'}, 'LayerData': {'Raw': b'}

}', 'EndOfLayer': b'\x1a'}} 4763823808 4763822400
order must be str, not int

Any Idea how I can generate PNGs that I can reimport?

@sn4k3
Copy link

sn4k3 commented Mar 11, 2022

Native sliced images are 24 bits, printers don't need the extra alpha byte.
You can use UVtools to do that kind of stuff, either via UI or scripting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants