any way to save an image to 8-bit indexed png format?
1,282 views
Skip to first unread message
sleepy
unread,
Jul 12, 2016, 10:32:55 PM7/12/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
I need to shrink images to as small as possible with an acceptable quality.
found https://tinypng.com/ could convert the image to 8-bit indexed png, which is best fit my requirement.
however, I need to do this by my go program, any hints for this?
thanks in advance.
xiio...@gmail.com
unread,
Jul 13, 2016, 12:08:07 PM7/13/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Have you tried converting a starting image - lets say in color.NRGBA palette to a new 8 bit palette image (eg there are two at https://golang.org/pkg/image/color/palette/ )
ie using the function : func (p Palette) Convert(c Color) Color to convert the (32bit) image pixels to an 8 bit palette image.
and then passing this paletted image to the PNG.encode function like you would with any other image
??
[haven't actually checked if the PNG package will work with this - but this would be the way to go if supported]
Nigel Tao
unread,
Jul 13, 2016, 10:54:40 PM7/13/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to xiio...@gmail.com, golang-nuts
On Thu, Jul 14, 2016 at 2:07 AM, <xiio...@gmail.com> wrote:
> [haven't actually checked if the PNG package will work with this - but this
> would be the way to go if supported]