List Info

Thread: Re: Confusion about combinations of color_type and bit_depth




Re: Confusion about combinations of color_type and bit_depth
user name
2007-02-16 01:42:55
On 16/02/07, mal content <artifact.onegooglemail.com> wrote:
> I suspect I'm also misunderstanding the exact meaning
of 'bit_depth'.
> I'm used to dealing with images in terms of bits per
pixels, but going
> by the libpng docs, the maximum value that 'bit_depth'
can contain
> is 16(?) and I'm pretty sure I have at least a 24-bit
PNG file here.

Ah, ignore this part. Bits per channel.

MC

------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
png-mng-implement mailing list
png-mng-implementlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/png-m
ng-implement

Re: Confusion about combinations of color_type and bit_depth
user name
2007-02-16 02:18:35
On 2/15/07, mal content <artifact.onegooglemail.com> wrote:
> How do I detect an alpha channel in a paletted image?

Paletted images don't have a full alpha channel per se, but
can have a
distinct alpha value per palette entry. With libpng I think
you want
to check if png->num_trans is greater than zero.

Chris

------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
png-mng-implement mailing list
png-mng-implementlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/png-m
ng-implement

Re: Confusion about combinations of color_type and bit_depth
user name
2007-02-16 02:51:02
On 16/02/07, Chris Nokleberg <chrissixlegs.com> wrote:
>
> Paletted images don't have a full alpha channel per se,
but can have a
> distinct alpha value per palette entry. With libpng I
think you want
> to check if png->num_trans is greater than zero.
>

Yes, thanks, that seemed to work.

MC

------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
png-mng-implement mailing list
png-mng-implementlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/png-m
ng-implement

Re: Confusion about combinations of color_type and bit_depth
user name
2007-02-16 02:57:55
On 16/02/07, mal content <artifact.onegooglemail.com> wrote:
> On 16/02/07, Chris Nokleberg <chrissixlegs.com> wrote:
> >
> > Paletted images don't have a full alpha channel
per se, but can have a
> > distinct alpha value per palette entry. With
libpng I think you want
> > to check if png->num_trans is greater than
zero.
> >

Actually, I've hit another problem. Where are these distinct
alpha
values stored?

png_info_struct.palette points to an array of
png_color_struct,
but png_color_struct only contains r, g and b members.

thanks,
MC

------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
png-mng-implement mailing list
png-mng-implementlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/png-m
ng-implement

Re: Confusion about combinations of color_type and bit_depth
user name
2007-02-16 09:28:27
On 2/16/07, mal content <artifact.onegooglemail.com> wrote:
> On 16/02/07, mal content <artifact.onegooglemail.com> wrote:
> > On 16/02/07, Chris Nokleberg <chrissixlegs.com> wrote:
> > >
> > > Paletted images don't have a full alpha
channel per se, but can have a
> > > distinct alpha value per palette entry. With
libpng I think you want
> > > to check if png->num_trans is greater than
zero.
> > >
>
> Actually, I've hit another problem. Where are these
distinct alpha
> values stored?

png_ptr->trans
There are png_ptr->num_trans entries
trans and num_trans are accessible through png_get_tRNS().

If the palette is larger than num_trans, the remaining
values are all
implicitly opaque.

>
> png_info_struct.palette points to an array of
png_color_struct,
> but png_color_struct only contains r, g and b members.
>
> thanks,
> MC
>
>
------------------------------------------------------------
-------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the
chance to share your
> opinions on IT & business topics through brief
surveys-and earn cash
> http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> png-mng-implement mailing list
> png-mng-implementlists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/png-m
ng-implement
>

------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
png-mng-implement mailing list
png-mng-implementlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/png-m
ng-implement

Re: Confusion about combinations of color_type and bit_depth
country flaguser name
United States
2007-02-16 10:35:54
> I'm trying to write a small C library, using libpng, to
open PNG files with
> the intention of loading them into OpenGL textures.

On a completely different tack, I'll just note this:

	http://
www.wyatt100.freeserve.co.uk/glpng.zip

Also, this doesn't exist:

>     case PNG_COLOR_TYPE_GRAY_ALPHA:
>       if (info_ptr->bit_depth == 1)
>         png->type = PNGLOAD_MONOCHROME_ALPHA;

Depth is 8 or 16.

Greg

------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
png-mng-implement mailing list
png-mng-implementlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/png-m
ng-implement

Re: Confusion about combinations of color_type and bit_depth
user name
2007-02-16 18:56:53
Thanks to all who offered help, it seems to be working
nicely now (and I've
removed the bit_depth check in PNG_COLOR_TYPE_GRAY_ALPHA).

MC

------------------------------------------------------------
-------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the
chance to share your
opinions on IT & business topics through brief
surveys-and earn cash
http://www.techsay.com/default.
php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
png-mng-implement mailing list
png-mng-implementlists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/png-m
ng-implement

[1-7]

about | contact  Other archives ( Real Estate discussion Medical topics )