Quantcast
Channel: magick Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1011

Commented Unassigned: Converting to pcx files ignores bit depth [1198]

$
0
0
I have a project that requires me to convert a jpg to a pcx image with a bit depth of 1. Basically a black and white image.

Here's what i'm doing.

```
Using image As New MagickImage("color.jpg")
image.Threshold(New ImageMagick.Percentage(60))
image.BitDepth(1)
image.Write("blackandwhite.pcx")
End Using
```

the resulting image is black and white with 2 colors only, but the bit depth is 24

if I change this line:
```
image.Write("blackandwhite.pcx")
```
to:
```
image.Write("blackandwhite.tif")
```
the color depth is saved properly as a tif, however this doesn't help me because I need a pcx file

I've attached screenshots of the image properties from IrfanView

Thanks
Comments: ** Comment from web user: dlemstra **

The bit depth is not used by the pcx writer. You will have to reduce the colors like this:
```C#
using (MagickImage image = new MagickImage("color.jpg"))
{
image.Threshold(60);
// Reduce the colors:
image.Quantize(new QuantizeSettings()
{
Colors = 2
});
image.Write("blackandwhite.pcx");
}
```

There was however another bug in ImageMagick that prevents this from working with the current version of Magick.NET. It will work in the next version of Magick.NET (6.8.8.1001).


Viewing all articles
Browse latest Browse all 1011

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>