question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

1bit PCX conversion fails since 7.3.0

See original GitHub issue

Coming from 7.0.0.14, I convert a .png-file to 1bit .pcx-file with the following code:

using System;
using System.Drawing;
using ImageMagick;

using (var bitmap = (Bitmap) Bitmap.FromFile(path))
using (var magickImage = new MagickImage(bitmap))
{
  if (magickImage.HasAlpha)
  {
    magickImage.ColorAlpha(new MagickColor(Color.White)); // in later versions MagickColors.White
  }

  var quantizeSettings = new QuantizeSettings
                         {
                           ColorSpace = ColorSpace.GRAY, // in later versions ColorSpace.Gray
                           Colors = 2
                         };
  magickImage.Quantize(quantizeSettings);

  magickImage.ColorType = ColorType.Bilevel;
  magickImage.Depth = 1;
  magickImage.Format = MagickFormat.Pcx;

  var array = magickImage.ToByteArray();
}

Now, inspecting the PXC header of array at offset 3:

Offset Size Description Value
0 1 Manufacturer 10 ✔️
1 1 PCX version number 5 ✔️
2 1 RLE 1 ✔️
3 1 Depth 1 ✔️

With 7.3.0 Depth changes to 8:

offset size description value
0 1 Manufacturer 10 ✔️
1 1 PCX version number 5 ✔️
2 1 RLE 1 ✔️
3 1 Depth 8 💩 ⚡ 💣

What and why has that behavior changed? How can I get the initial behavior back?

Additionally, the output size has changed (WHY??):

  • 7.0.0.14: 1,565 bytes
  • 7.0.1: 7,350 bytes :suspect: (this release fixes some alpha-issues I have with some images, so this ain’t a problem 😁)
  • 7.3.0: 22,586 bytes :goberserk:
  • 7.4.5: 66,341 bytes :trollface:

Best Andreas

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dittodholecommented, May 28, 2018

@dlemstra Thanks for the fix - I’ve validated the new version with various .png-files and checked the actual byte content for 7.0.1 vs 7.4.6 👍 The actual binary output matches between versions 😄

0reactions
dittodholecommented, May 24, 2018

@dlemstra Thanks for the ping, I will test the new release this eve.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Releases · python-pillow/Pillow
Documentation · Removed unused sections in release notes #7054 [@radarhere] · Add missing word #7051 [@Yay295] · Document handling of modes when converting...
Read more >
Untitled
After effect export transparent png frame by frame, Baby shower party needs, ... Alex kidd video game, Electrical system failure, Gloria jeans pakistan, ......
Read more >
CVE-2019-11324
Security Bulletin: vulnerability in urllib3 library embedded into Tensorboard PowerAI CVE-2019-11324. 2019-07-01 17:40:01 · Security Bulletin: ...
Read more >
VirtualViewer HTML5 Java Client Admin Guide.pdf
failure. First, as before, if an image is loaded as an SVG, VirtualViewer will attempt to reload it as a raster image. After...
Read more >
Reflexw Manual A4 Booklet | PDF | License | Copyright
conversion fails try to change this parameter. filename specification: manual input filename: any name (e.g. line1_all_shots) TimeDimension: ms
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found