Export to PNG with custom color palette

Post questions on how to use or achieve an effect in Inkscape.
Croog
Posts: 2
Joined: Fri Apr 19, 2019 5:54 am

Export to PNG with custom color palette

Postby Croog » Fri Apr 19, 2019 6:12 am

Hello,

I have image (logo) in Inkscape which contains two colors and also have custom color palette with 64 colors (these are colors which are supported by LCD screen where logo will be rendered). When I export image to bitmap it will do antialiasing on exported image without considering used color palette, so it contains much more colors. Is it possible to do export to bitmap with keeping colors only from opened color palette?

I have very little experience with vector editor, so I hope my question make sense.
Thank you for your help!
Jan

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Export to PNG with custom color palette

Postby druban » Fri Apr 19, 2019 10:12 am

Export at a higher resolution than needed (2-4x). Open it in an image editor, resize it down with no antialiasing and save it as a 64 color png. Maybe convert it to 64 color first if your editor supports an indexed mode.
This generally works although you might have to clean up a bit.
Your mind is what you think it is.

Croog
Posts: 2
Joined: Fri Apr 19, 2019 5:54 am

Re: Export to PNG with custom color palette

Postby Croog » Fri Apr 19, 2019 3:48 pm

Yes, this is something what I was doing, but without antialiasing the resulted image has still just 2 colors, so the angled edges looks bad. So I would like to keep some sort of smoothing or antialiasing, because I believe in that 64 color palette are enough colors for much better result. If this is not possible in Inkscape, is there please some bitmap editor to recommend, which supports antialiasing algorithm on custom color palette?

The image is converted to the right colors even from the beginning. It is just white logo on blue background. I am using paint.net or Zoner Studio as bitmap editor but I didn't find solution to this. I don't want to do it manually in pixelart form of course.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Export to PNG with custom color palette

Postby brynn » Fri Apr 19, 2019 7:43 pm

It is possible to disable antialiasing in Inkscape. I'm not sure at what stage of the game you need to disable it - whether you should disable it before you draw the image, or only before you export it. But you can experiment.

Document Properties > Page tab, at the bottom.

Although.... While disabling it should prevent the extra colors, it might not be acceptable in terms of how the image will look. The smooth, clean lines will be gone. Depending on the image, it's possible you won't notice the difference.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Export to PNG with custom color palette

Postby Moini » Fri Apr 19, 2019 10:18 pm

Inkscape 1.0 will allow for a couple bit depth settings for PNG: http://wiki.inkscape.org/wiki/index.php ... PNG_images
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Export to PNG with custom color palette

Postby druban » Sat Apr 20, 2019 8:17 am

Turning off antialiasing for the display makes no difference for PNG exports, it's pretty easy to check this, but of course I am running the standard version of Inkscape so this may not apply to special versions, if there is a version where this is different I would definitely want to use it (unless of course it's only available to developers).

One might think that with AA turned off for onscreen display at least "make a bitmap copy" might produce an aliased image, capturing directly from the draw buffer, but that is surprisingly not so.

Lazur has done a lot of research and has some great threads on this topic that people who have been here for a while might be familiar with.
Your mind is what you think it is.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Export to PNG with custom color palette

Postby Moini » Sat Apr 20, 2019 8:53 am

druban, your wishes have come true: http://wiki.inkscape.org/wiki/index.php ... PNG_images (the prerelease is a bit unstable, though, esp. with text)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Export to PNG with custom color palette

Postby druban » Sat Apr 20, 2019 9:26 am

And the pony??? :D

I like how the notes say "Definitely not released yet"
Your mind is what you think it is.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Export to PNG with custom color palette

Postby Moini » Sat Apr 20, 2019 10:49 am

We had ponies in the user chat today... :) Here's one for you:
Bildschirmfoto_2019-04-20_02-48-19.png
Bildschirmfoto_2019-04-20_02-48-19.png (549 Bytes) Viewed 1913 times
(sorry, i wanted to insert the UTF-8 one, but the forum refused to add it)

(when searching for this, this made me doubt the sanity of the utf-8 committee: http://www.fileformat.info/info/unicode ... /index.htm)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Export to PNG with custom color palette

Postby brynn » Sun Apr 21, 2019 2:21 pm

druban wrote:One might think that with AA turned off for onscreen display at least "make a bitmap copy" might produce an aliased image, capturing directly from the draw buffer, but that is surprisingly not so.


That is very surprising. What's the point of being able to disable it, if you can't export an image that way?

I wonder why? Would it be considered a bug, or is there some reason for it, or explanation?

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Export to PNG with custom color palette

Postby Moini » Mon Apr 22, 2019 9:20 am

I guess it was only implemented for speeding up rendering, not for export.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Export to PNG with custom color palette

Postby brynn » Mon Apr 22, 2019 10:46 am

Oh, I see. I never thought of it like that. I thought it was to allow users to draw without it, something like a pixel editor, maybe.

Well I wonder if a basic screenshot tool would "see" it? Testing....

Windows' Snipping Tool "sees" it.

noaa.png
noaa.png (2.32 KiB) Viewed 1837 times


Interesting....


Return to “Help with using Inkscape”