-monochrome memory usage

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
a5292615

-monochrome memory usage

Post by a5292615 »

When converting relative small images to a monochrome ones
I get 64M+ memory usage

Code: Select all

# strace -e munmap convert in.png -monochrome out.png
...
munmap(0xb1d63000, 67112960)            = 0
...

# identify -version
Version: ImageMagick 6.6.3-4 2010-08-10 Q8 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP

# identify in.png
in.png PNG 275x95 275x95+0+0 8-bit PseudoClass 256c 7.33KB 0.000u 0:00.000
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -monochrome memory usage

Post by fmw42 »

monochrome will always dither your image

plus if you are on Q16, you could reduce the size by using -depth 8

better perhaps to use -quantize gray +dither -colors 2

see http://www.imagemagick.org/Usage/quantize/
a5292615

Re: -monochrome memory usage

Post by a5292615 »

so dithering will always map 64MiB independent of how small the input image is?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -monochrome memory usage

Post by fmw42 »

Not on my system, IM 6.6.3.4 Q16 Mac OSX Tiger

convert rose: -monochrome rose_mono.png
identify -verbose rose_mono.png

Filesize: 550B



This is 550 bytes.


identify rose_mono.png

rose_mono.png PNG 70x46 70x46+0+0 8-bit PseudoClass 2c 550B 0.000u 0:00.000
a5292615

Re: -monochrome memory usage

Post by a5292615 »

i'm talking about memory usage, not the file size

strace -e munmap convert rose: -monochrome rose_mono.png
munmap(0xb77a8000, 60481) = 0
munmap(0xb77b6000, 4096) = 0
munmap(0xb77b6000, 2003) = 0
munmap(0xb65d5000, 2403) = 0
munmap(0xb65ca000, 47460) = 0
munmap(0xb65d5000, 4096) = 0
munmap(0xb5d98000, 249856) = 0
munmap(0xb1d97000, 67112960) = 0
munmap(0xb5dd4000, 4096) = 0
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -monochrome memory usage

Post by fmw42 »

Sorry, I misunderstood. I know nothing about that. You will need a response from some one else. Sorry for the wrong information.
Post Reply