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

Transparency in PNG files is replaced by black background #142

Open
tinloaf opened this Issue May 23, 2017 · 6 comments

Comments

Projects
None yet
3 participants
@tinloaf

tinloaf commented May 23, 2017

Hi,

I'm trying to include a PNG file with transparent parts ( as an example, use http://i11www.iti.kit.edu/~barth/ipe.png ) in ipe 7.2.6. However, when I do that, I get a black background for the PNG instead of a transparent one. This also remains if I render the file to PDF. It also persists if I include the PNG via \includegraphics{} instead of Ctrl-Shift-O.

Am I doing something wrong or is this a bug?

Thanks a lot,

Lukas

@otfried otfried added the enhancement label May 23, 2017

@otfried otfried self-assigned this May 23, 2017

@otfried

This comment has been minimized.

Show comment
Hide comment
@otfried

otfried May 24, 2017

Owner

Ipe doesn't support mask transparency - only colorkey transparency (which is detected automatically when the image is imported). Adding mask transparency (from the alpha channel in the PNG) is on my todo list.

I thought it should work with \includegraphics - that needs to be investigated. Make sure not to apply any opacity value to the text object that contains the \includegraphics call.

Owner

otfried commented May 24, 2017

Ipe doesn't support mask transparency - only colorkey transparency (which is detected automatically when the image is imported). Adding mask transparency (from the alpha channel in the PNG) is on my todo list.

I thought it should work with \includegraphics - that needs to be investigated. Make sure not to apply any opacity value to the text object that contains the \includegraphics call.

@aureooms

This comment has been minimized.

Show comment
Hide comment
@aureooms

aureooms May 30, 2018

I don't know what you mean by "colorkey transparency is automatically detected on import". Often it is not. I work around it by adding ColorKey="6letterhexadecimalcolorcode" to each bitmap object in the ipe file.

I don't know what you mean by "colorkey transparency is automatically detected on import". Often it is not. I work around it by adding ColorKey="6letterhexadecimalcolorcode" to each bitmap object in the ipe file.

@otfried

This comment has been minimized.

Show comment
Hide comment
@otfried

otfried May 31, 2018

Owner

Can you attach a bitmap where automatic detection doesn't work so that I can investigate?

Owner

otfried commented May 31, 2018

Can you attach a bitmap where automatic detection doesn't work so that I can investigate?

@aureooms

This comment has been minimized.

Show comment
Hide comment
@aureooms

aureooms May 31, 2018

Maybe I just don't know how to add ColorKey transparency directly to the png file. What tool can do that?

In GIMP, I remove the alpha channel then I export to png and check the "keep background color" option. The background comes up white. If I don't check that option then the background is black. I am probably doing something wrong.

I could attach an example image once I get on a computer.

Maybe I just don't know how to add ColorKey transparency directly to the png file. What tool can do that?

In GIMP, I remove the alpha channel then I export to png and check the "keep background color" option. The background comes up white. If I don't check that option then the background is black. I am probably doing something wrong.

I could attach an example image once I get on a computer.

@otfried

This comment has been minimized.

Show comment
Hide comment
@otfried

otfried May 31, 2018

Owner

Maybe the easiest would be to add a field for a colorkey to the import dialog...

Ipe uses the png_get_tRNS function of libpng to determine a color key. This will only work if either the image is in palette mode, with a single fully-transparent palette entry (and all other entries fully opaque), or if it's an RGBA image where one specific color is always fully transparent, and no other color having any transparency. I suppose that when you draw on a transparent background, then the boundary will have many partially transparent pixels, and so this will fail.

It would be good to see an example so I can investigate what exactly happens. In the near future I will add mask-transparency, so then you can simply keep your alpha-channel.

Owner

otfried commented May 31, 2018

Maybe the easiest would be to add a field for a colorkey to the import dialog...

Ipe uses the png_get_tRNS function of libpng to determine a color key. This will only work if either the image is in palette mode, with a single fully-transparent palette entry (and all other entries fully opaque), or if it's an RGBA image where one specific color is always fully transparent, and no other color having any transparency. I suppose that when you draw on a transparent background, then the boundary will have many partially transparent pixels, and so this will fail.

It would be good to see an example so I can investigate what exactly happens. In the near future I will add mask-transparency, so then you can simply keep your alpha-channel.

@aureooms

This comment has been minimized.

Show comment
Hide comment
@aureooms

aureooms May 31, 2018

It would also be easy with an entry in the contextual menu of image objects.

It would also be easy with an entry in the contextual menu of image objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment