Page 1 of 1

-monochrome memory usage

Posted: 2010-08-09T22:53:13-07:00
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

Re: -monochrome memory usage

Posted: 2010-08-10T10:55:08-07:00
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/

Re: -monochrome memory usage

Posted: 2010-08-10T11:20:44-07:00
by a5292615
so dithering will always map 64MiB independent of how small the input image is?

Re: -monochrome memory usage

Posted: 2010-08-10T11:40:37-07:00
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

Re: -monochrome memory usage

Posted: 2010-08-10T11:59:09-07:00
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

Re: -monochrome memory usage

Posted: 2010-08-10T12:40:04-07:00
by fmw42
Sorry, I misunderstood. I know nothing about that. You will need a response from some one else. Sorry for the wrong information.