List Info

Thread: How do I lock color depth at a minimum level?




How do I lock color depth at a minimum level?
country flaguser name
United States
2007-03-09 00:26:44
Hi Folks,

I'm working with png images that are only two colors, black
and red. I'm using a palette and setting the black to be
transparent. I start out with 24bit images and am trying to
use the convert tool to change them to 8bit images. I'm
using the following command:
convert myFile.png PNG8:myFile.png

I've tried various options such as the -depth flag, -colors
flag, and any other flag that looked like it would lock the
bit depth. However, whatever I do, I always end up with an
image with 2 bits per pixel rather than 8. Unfortunately,
the program I'm displaying the png's in really doesn't like
images with less that 8bits. Does anybody know how to force
this option?

If I open the file in IrfanView and then save it in
IrfanView it comes out with the correct 8 bit pixels, so I
know it's possible.

Suggestions?

Thanks,
Andrew


Andrew C. Chase
Software Engineer
Monterey Bay Aquarium Research Institute
_______________________________________________
Magick-users mailing list
Magick-usersimagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users

Re: How do I lock color depth at a minimum level?
user name
2007-03-09 01:09:19
"Chase, Andrew" on  wrote...
| Hi Folks,
| 
| I'm working with png images that are only two colors,
black and red.
| I'm using a palette and setting the black to be
transparent. I start
| out with 24bit images and am trying to use the convert
tool to change
| them to 8bit images. I'm using the following command:
|
| convert myFile.png PNG8:myFile.png
| 
PNG8 is basically GIF color handling encoded into PNG.
I'll treat this as
     convert myFile.png myFile.gif
instead.

| I've tried various options such as the -depth flag,
-colors flag, and
| any other flag that looked like it would lock the bit
depth. However,
| whatever I do, I always end up with an image with 2 bits
per pixel
| rather than 8.
|
bit depth does not get used for  GIF or PNG8.  it is more
for things
with variable depth like raw RGB, TXT, PPM, etc...

For PNG8 and GIF IM always uses the minimum color table
(power of 2 in
size) needed to hold the number of colors in the image.

You are the first to request something other than this.

| Unfortunately, the program I'm displaying the png's in
| really doesn't like images with less that 8bits. Does
anybody know how
| to force this option?
| 
Then don't use  PNG8  as IM uses 8bit colors in a 8bit color
index.

PNG has lots of formating controls, not all implemented. 
Many such
controls may even be undocumented.  (the -define controls)

I have tried to document them as I see them but there is not
formal
source of info, other than the source code itself for this 
:-(

Usally things get added as users request them and Cristy has
time.

| If I open the file in IrfanView and then save it in
IrfanView it comes
| out with the correct 8 bit pixels, so I know it's
possible.
| 
Okay you always want a 256 color table.

One thing you can TRY (may not work) is to give the image a
fixed -map
of 256 colors, including red and black.  You could try the
   colormap_332.png
image create in IM examples.  (256 colors, no transparency)
   http://www.imagemagick.org/Usage/quantize/#map_colormaps


Or even the builtin netscape: color map  (219 colors)

  Anthony Thyssen ( System Programmer )    <A.Thyssengriffith.edu.au>
 -----------------------------------------------------------
------------------
  Okay, who stopped the payment on my reality check?   -- A
Bumper Sticker
 -----------------------------------------------------------
------------------
     Anthony's Home is his Castle     http://www.cit.gu.
edu.au/~anthony/
_______________________________________________
Magick-users mailing list
Magick-usersimagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick
-users

[1-2]

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