Page 1 of 2

Converting PSD File (Bitmap mode) into various formats results in black image on linux

Posted: 2018-07-18T07:39:59-07:00
by rene1996
Hello,

At work I have to convert a psd file which image mode is bitmap into a png. This convert results in a black image.
I tried converting into other formats just like jpg, tiff, gif, bmp always with the same result of a totally black image. I tried different options like -flatten or -alpha on/off. Again a black result image.

This only happens on my linux system. On windows 10 with "ImageMagick-7.0.3-Q16" or "ImageMagick-6.9.6-Q16-HDRI" it works perfectly...
But I need to convert it on a linux system because our customer is using one.

My linux system:

Code: Select all

Linux vagrant-rene 4.4.0-130-generic #156-Ubuntu SMP Thu Jun 14 08:53:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
My imagemagick version on linux:

Code: Select all

Version: ImageMagick 6.8.9-9 Q16 x86_64 2018-07-10
You can download the test psd file from here:
https://mega.nz/#!V1UDRAaQ!XFoljIIQ4FWu ... OvGvlwhuno

Does anybody have an idea what I am may be doing wrong or is this a known bug?

Thank you for your help!

Best regards
Rene

Re: Converting PSD File (Bitmap mode) into various formats results in black image on linux

Posted: 2018-07-18T09:03:39-07:00
by fmw42
This works fine for me on ImageMagick 6.9.10.6 Q16 and 7.0.8.6 Q16 HDRI Mac OSX Sierra. Also with version 6.8.9.9 Q16.

Code: Select all

convert bitmap.psd[0] bitmap.png
You could also try

Code: Select all

convert bitmap.psd[0] -type bilevel bitmap.png
or

Code: Select all

convert bitmap.psd[0] -depth 1 bitmap.png

Re: Converting PSD File (Bitmap mode) into various formats results in black image on linux

Posted: 2018-07-18T23:27:37-07:00
by fmw42
P.S. What is your exact ImageMagick version 7.0.3.x and 6.9.6.x. Both are rather old. You might consider upgrading. What was your exact command line?

Re: Converting PSD File (Bitmap mode) into various formats results in black image on linux

Posted: 2018-07-18T23:28:13-07:00
by rene1996
Thanks fmw42!!!

Code: Select all

-type bilevel
did the trick! Thank you!

Re: Converting PSD File (Bitmap mode) into various formats results in black image on linux

Posted: 2018-07-18T23:29:10-07:00
by fmw42
OK. Great! But in the future, please provide full information about your IM version and command lines used.

Re: Converting PSD File (Bitmap mode) into various formats results in black image on linux

Posted: 2018-09-05T04:58:04-07:00
by Lem
Hi!

I encountered a problem that 'identify' hangs while treating converted psd files,
which might be related to this topic.

I use cygwin and imagemagick:

Code: Select all

$ convert -version$ convert -version
Version: ImageMagick 6.9.9-11 Q16 x86_64 2017-09-30 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC OpenMP
Delegates (built-in): autotrace bzlib cairo fftw fontconfig fpx freetype gslib jbig jng jp2 jpeg lcms lzma pangocairo png ps rsvg tiff webp x xml zlib
Version: ImageMagick 6.9.9-11 Q16 x86_64 2017-09-30 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php!/bin/sh -x

base64 -d > a.png <<END || exit 1
iVBORw0KGgoAAAANSUhEUgAAACUAAAAbAQAAAADTlXtzAAAAZ0lEQVQI12P4DwQ/GCDkAQYGBgkg
WQEm/4BIRiSS9S+bBMMRhn+MIJEahhlANS1A8UMGDZ8iGC4zMABlLzdwsEuA2REMByw6jIAkQwPY
hB9A9UeYQXoPsv5pQjMZYhdDAZgEuQHJVQB3xTpG4li8ywAAAABJRU5ErkJggg==
END

convert -version || exit 1

convert a.png a1.psd \
&& identify a1.psd \
&& identify -verbose a1.psd \
|| exit 1

convert a.png -monochrome a1.psd \
&& identify a1.psd \
&& identify -verbose a1.psd \
|| exit 1

convert a.png -monochrome -depth 1 a2.psd \
&& identify a2.psd \
&& identify -verbose a2.psd \
|| exit 1

echo OK
Features: Cipher DPC OpenMP
Delegates (built-in): autotrace bzlib cairo fftw fontconfig fpx freetype gslib jbig jng jp2 jpeg lcms lzma pangocairo png ps rsvg tiff webp x xml zlib
A test script below hangs at 'identify -verbose a2.psd'

Code: Select all

#!/bin/sh -x

base64 -d > a.png <<END || exit 1
iVBORw0KGgoAAAANSUhEUgAAACUAAAAbAQAAAADTlXtzAAAAZ0lEQVQI12P4DwQ/GCDkAQYGBgkg
WQEm/4BIRiSS9S+bBMMRhn+MIJEahhlANS1A8UMGDZ8iGC4zMABlLzdwsEuA2REMByw6jIAkQwPY
hB9A9UeYQXoPsv5pQjMZYhdDAZgEuQHJVQB3xTpG4li8ywAAAABJRU5ErkJggg==
END

convert -version || exit 1

convert a.png a1.psd \
&& identify a1.psd \
&& identify -verbose a1.psd \
|| exit 1

convert a.png -monochrome a1.psd \
&& identify a1.psd \
&& identify -verbose a1.psd \
|| exit 1

convert a.png -monochrome -depth 1 a2.psd \
&& identify a2.psd \
&& identify -verbose a2.psd \
|| exit 1

echo OK

Re: Converting PSD File (Bitmap mode) into various formats results in black image on linux

Posted: 2018-09-05T06:16:54-07:00
by snibgo
I suggest you post a link to a2.psd.

Re: Converting PSD File (Bitmap mode) into various formats results in black image on linux

Posted: 2018-09-05T06:34:18-07:00
by Lem
Thanks for comments.

But, 'a2.psd' is generated by 'convert a.png -monochrome -depth 1 a2.psd'.
And 'a.png' is given in the script in base64 encoding.

Or we can make the 'a2.psd' from this script:

Code: Select all

#!/bin/sh
base64 -d <<END > a2.psd
OEJQUwABAAAAAAAAAAEAAAAbAAAAJQABAAAAAAAAAAAAHDhCSU0D7QAAAAAAEAAAAAEAAQABAAAA
AQABAAEAAACoAAAAoAABAAAAAAAAAAAAAAAbAAAAJQABAAAAAABqOEJJTW5vcm3/AAEAAAAADAAA
AAAAAAAAAkwxAAACeJxjYGBgYGcAEfb///9/bv+/HUQwA4l/cOIX08/n1v8Z/wG5zf/T7f9X/39u
e76ed7nO//8/n+vUf//xHMRabn+8/Oxy+//1IG3s/9Ot/wB12P1irkU2Cmzy/34QAbSNAW45ADXc
TDUAAAAAAAEABQAFAAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgA
BwAFAAX9AAAHgP0AAAeAAD/+/wDngAE//wKH/+eAAT//AgP/54ABP/4CA//ngAE//gID/+eAAT/6
AgL554ABO/8CAf7ngAE//gKD/2eAAT//Anv/54ABPc8Cfw2ngAEs/wL/+eeAASx/Avf454ABLP8C
//mngAE/xwJ3zaeAAT//An//54ABP/4CB/9ngAE7/AIB/ueAAT76AgN954ABP/4CA//ngAE//gID
/+eAAT//AgP/54ABP/8Cj//ngAA//v8A54D9AAAHgP0AAAeA
END

Re: Converting PSD File (Bitmap mode) into various formats results in black image on linux

Posted: 2018-09-05T09:17:15-07:00
by fmw42
Please post your actual a.png, since I cannot reproduce it from your script. You can post to some free hosting service that won't change the format such as dropbox.com and put the URL here.

Re: Converting PSD File (Bitmap mode) into various formats results in black image on linux

Posted: 2018-09-06T02:57:47-07:00
by Lem
Here, the files.
Please, check them.

https://www.dropbox.com/sh/fzm3bumq9vcr ... S2Aua?dl=0

Re: Converting PSD File (Bitmap mode) into various formats results in black image on linux

Posted: 2018-09-06T09:11:16-07:00
by fmw42
I convert a.png to a.psd as follows and I get proper information from identify or identify -verbose, using IM 6.9.10.11 Q16 and IM 7.0.8.11 Q16 Mac OSX.

Code: Select all

convert a.png a.psd
identify a.psd
a.psd[0] PSD 37x27 37x27+0+0 8-bit Grayscale Gray 256c 726B 0.000u 0:00.000
a.psd[1] PSD 37x27 37x27+0+0 8-bit Gray 256c 726B 0.000u 0:00.000

Code: Select all

magick a.png a.psd
magick identify a.psd
a.psd[0] PSD 37x27 37x27+0+0 8-bit Grayscale Gray 256c 726B 0.000u 0:00.000
a.psd[1] PSD 37x27 37x27+0+0 8-bit Gray 256c 726B 0.000u 0:00.000

Re: Converting PSD File (Bitmap mode) into various formats results in black image on linux

Posted: 2018-09-07T02:41:12-07:00
by Lem
Yes, it works 'convert a.png a1.psd; identify a1.psd'.

But, it's a differnt case from what I mean. Please test as follows:

convert a.png -monochrome -depth 1 a2.psd
identify -verbose a2.psd

Note that do it without omitting '-verbose'.

Re: Converting PSD File (Bitmap mode) into various formats results in black image on linux

Posted: 2018-09-07T02:47:54-07:00
by Lem

Code: Select all

convert a.png -monochrome -depth 1 a2.psd
identify -verbose a2.psd

Re: Converting PSD File (Bitmap mode) into various formats results in black image on linux

Posted: 2018-09-07T09:09:54-07:00
by fmw42
The issue is that doing

Code: Select all

convert a.png -monochrome -depth 1 a2.psd
or even

Code: Select all

convert a.png a.psd

Image: a.psd
Format: PSD (Adobe Photoshop bitmap)
Class: DirectClass
Geometry: 37x27+0+0
Units: PixelsPerInch
Colorspace: Gray
Type: Grayscale
Base type: Undefined
Endianess: MSB
Depth: 8-bit
Channel depth:
gray: 8-bit
...
Colors: 2
Histogram:
615: ( 0, 0, 0) #000000 gray(0)
384: ( 1, 1, 1) #010101 gray(1)

for some reason produces two values, 0 and 1, rather than 0 and 255. This looks like a bug.

The way to get around it is to do

Code: Select all

convert a.png -monochrome -type truecolor a2.psd
or

Code: Select all

convert a.png -type truecolor a.psd

Format: PSD (Adobe Photoshop bitmap)
Class: PseudoClass
Geometry: 37x27+0+0
Resolution: 1.52588e-05x1.52588e-05
Print size: 2.42483e+06x1.76947e+06
Units: PixelsPerInch
Colorspace: Gray
Type: Bilevel
Base type: Undefined
Endianess: MSB
Depth: 8-bit
Channel depth:
gray: 1-bit
...
Colors: 2
Histogram:
615: ( 0, 0, 0) #000000 gray(0)
384: (255,255,255) #FFFFFF gray(255)

Re: Converting PSD File (Bitmap mode) into various formats results in black image on linux

Posted: 2018-09-07T14:29:25-07:00
by Lem
Thank you for testing and reproducing the situations.

I noticed that this also hangs at 'identiy':

Code: Select all

convert a.png -depth 1 a_depth1.psd
identify -verbose a_depth1.psd
And ImageMagick version is: ImageMagick 6.9.9-11 Q16 x86_64 2017-09-30