Page 1 of 1
convert images to a specific format
Posted: 2011-10-12T16:54:45-07:00
by craigp
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?
Re: convert images to a specific format
Posted: 2011-10-12T18:28:56-07:00
by fmw42
Re: convert images to a specific format
Posted: 2011-10-12T20:18:27-07:00
by craigp
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
Posted: 2011-10-12T20:25:23-07:00
by craigp
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 ?? ()
Re: convert images to a specific format
Posted: 2011-10-12T21:38:26-07:00
by fmw42
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
Posted: 2011-10-13T11:34:04-07:00
by craigp
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>