I'm trying to use ImageMagick to convert PNGs to the following format
$file example.png
example.png: PNG image data, 1480 x 625, 1-bit colormap, non-interlaced
Currently they are in formats such as:
PNG image data, 1480 x 625, 8-bit colormap, non-interlaced
PNG image data, 1480 x 625, 8-bit grayscale, non-interlaced
PNG image data, 1480 x 625, 8-bit/color RGB, non-interlaced
Using mogrify -colors 2 only sends it to 8 bit grayscale.
What is the convert or mogrify command that I need to use?
convert images to a specific format
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: convert images to a specific format
try
1) -colors 2 -type bilevel result
2) -colors 2 PNG8:result
or
3) -monochrome PNG8:result
see
http://www.imagemagick.org/Usage/formats/#png_formats
http://www.imagemagick.org/Usage/formats/#png_write
1) -colors 2 -type bilevel result
2) -colors 2 PNG8:result
or
3) -monochrome PNG8:result
see
http://www.imagemagick.org/Usage/formats/#png_formats
http://www.imagemagick.org/Usage/formats/#png_write
Re: convert images to a specific format
Sweeeet I found a bug.
Code: Select all
craigp@lamina> convert atratus.png -define png:bit-depth=1 -define png:color-type=3 temp.png
Segmentation fault
Re: convert images to a specific format
I should probably make a bug report...
Code: Select all
craigp@lamina> gdb --args convert atratus.png -define png:bit-depth=1 -define png:color-type=3 temp.png
GNU gdb (Ubuntu/Linaro 7.2-1ubuntu11) 7.2
This GDB was configured as "i686-linux-gnu".
Reading symbols from /usr/bin/convert...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/convert atratus.png -define png:bit-depth=1 -define png:color-type=3 temp.png
[Thread debugging using libthread_db enabled]
Program received signal SIGSEGV, Segmentation fault.
0x00b04b9f in ?? () from /usr/lib/ImageMagick-6.6.2/modules-Q16/coders/png.so
(gdb) bt
#0 0x00b04b9f in ?? () from /usr/lib/ImageMagick-6.6.2/modules-Q16/coders/png.so
#1 0x00b06522 in ?? () from /usr/lib/ImageMagick-6.6.2/modules-Q16/coders/png.so
#2 0x00194ebd in WriteImage () from /usr/lib/libMagickCore.so.3
#3 0x00195932 in WriteImages () from /usr/lib/libMagickCore.so.3
#4 0x003c004f in ConvertImageCommand () from /usr/lib/libMagickWand.so.3
#5 0x00463462 in MagickCommandGenesis () from /usr/lib/libMagickWand.so.3
#6 0x080487cf in ?? ()
#7 0x00912e37 in __libc_start_main () from /lib/i386-linux-gnu/libc.so.6
#8 0x080486d1 in ?? ()
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: convert images to a specific format
You are using an old version of IM. PNG has been under development for improvements over many releases. So upgrade to the current version IM 6.7.3.0 and try again. It probably will work correctly.
Re: convert images to a specific format
Yes that fixed it. Thanks.
Code: Select all
craigp@lamina> ~/Desktop/ImageMagick-6.7.3-1/utilities/convert atratus.png -define png:bit-depth=1 -define png:color-type=3 temp.png; file temp.png; rm temp.png
temp.png: PNG image data, 1480 x 625, 1-bit colormap, non-interlaced
craigp@lamina>