Problem converting .mac files

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Locked
Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Problem converting .mac files

Post by Jason S »

Using most any .mac (Macpaint) file, such as this one...

This does not work for me. I get an all-black image.

Code: Select all

convert cats.mac cats.tif
But this works:

Code: Select all

convert cats.mac cats.png
Some target formats work (PNG, BMP, MIFF), and others don't (TIFF, JPEG, PBM), with no obvious pattern.

[Version: ImageMagick 6.8.9-1 Q16 x86_64 2014-05-17, Features: DPC OpenMP]

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problem converting .mac files

Post by snibgo »

It converts fine for me, IM v6.8.9-0 on Windows 8.1, giving pictures of two cats, drawn with black pixels on a white background.

However, "identify -verbose cats.mac" claims it has only black pixels:

Code: Select all

Image: cats.mac
  Format: MAC (MAC Paint)
  Class: PseudoClass
  Geometry: 576x720+0+0
  Units: Undefined
  Type: Bilevel
  Base type: Bilevel
  Endianess: Undefined
  Colorspace: Gray
  Depth: 1-bit
  Channel depth:
    gray: 1-bit
  Channel statistics:
    Gray:
      min: 0 (0)
      max: 0 (0)
      mean: 0 (0)
      standard deviation: 0 (0)
      kurtosis: 0
      skewness: 0
  Colors: 1
  Histogram:
    414720: (  0,  0,  0) #000000 gray(0)
  Colormap entries: 2
  Colormap:
         0: (  0,  0,  0) #000000 gray(0)
         1: (255,255,255) #FFFFFF gray(255)
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: gray(255)
  Border color: gray(223)
  Matte color: gray(189)
  Transparent color: gray(0)
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 576x720+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Undefined
  Orientation: Undefined
  Properties:
    date:create: 2014-05-17T20:32:31+01:00
    date:modify: 2014-05-17T20:32:17+01:00
    signature: 19892baa96112082ecc7fc436c1259ffea83303327ee04eda98c966ee302815b
  Artifacts:
    filename: cats.mac
    verbose: true
  Tainted: True
  Filesize: 5.76KB
  Number pixels: 415K
  Pixels per second: 9.223372EB
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.8.9-0 Q16 x64 2014-04-06 http://www.imagemagick.org
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem converting .mac files

Post by fmw42 »

[Version: ImageMagick 6.8.9-1 Q16 x86_64 2014-05-17, Features: DPC OpenMP]
Show the list of delegates. You may be missing libtiff, libjpeg,etc. Did you install from source or from binary? If from source, you must successfully install all needed delegates before installing IM.

Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Re: Problem converting .mac files

Post by Jason S »

valgrind reports a number of "Conditional jump or move depends on uninitialised value" issues when I convert a .mac file. If that's related, there may well be some randomness to it. (But for me, it seems completely deterministic on three completely different platforms with three completely different versions of IM.)

PBM format doesn't use a delegate, but anyway:
I installed from source.
Delegates: bzlib djvu fontconfig freetype jng jpeg lcms lqr openexr pangocairo png tiff webp x xml zlib

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Problem converting .mac files

Post by fmw42 »

I think there is something odd about your uploaded file. I cannot download it except as text format and Preview won't open it. If I open it in Safari, it launches quicktime and shows a completely black image. Can you upload it as a zipped file for better downloading or use dropbox.com?

Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Re: Problem converting .mac files

Post by Jason S »

I propose this patch. It seems to fix it for me, at least.

Code: Select all

--- a/ImageMagick-6.8.9-1/coders/mac.c  2013-12-01 14:47:50.000000000 +0000
+++ b/ImageMagick-6.8.9-1/coders/mac.c  2014-05-21 17:59:00.393848099 +0000
@@ -244,6 +244,7 @@
     }
   }
   pixels=(unsigned char *) RelinquishMagickMemory(pixels);
+  (void) SyncImage(image);
   (void) CloseBlob(image);
   return(GetFirstImageInList(image));
 }

Locked