Montage inserting whitespace even with +0+0 geometry [SOLVED]

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
squiddy
Posts: 20
Joined: 2018-09-27T02:53:52-07:00
Authentication code: 1152

Montage inserting whitespace even with +0+0 geometry [SOLVED]

Post by squiddy »

Version: ImageMagick 6.9.10-14 Q16 i686 2018-11-10 Linux 32 bit
Delegates (built-in): bzlib fontconfig freetype jbig jng jpeg lcms lqr lzma pangocairo png tiff wmf x xml zlib
________

I've long used montage to throw a handful of screenshots together, e.g.

Code: Select all

 montage *png -geometry +0+0 montager.png
and this has worked faultlessly until today.

Today's variation is that I created a bunch of pngs from text files, using this:

Code: Select all

 convert -background black -fill white -font droid-sans-mono -pointsize 14 label:@TEXTFILE outfile.png
I then tried to montage them as usual, only to find that the montaged image has extra whitespace, and we get an error message:

Code: Select all

# montage *png  -geometry +0+0 montager.png
montage: unable to read font `helvetica' @ error/annotate.c/RenderFreetype/1333
I've tried lots of variations on -tile settings, to no avail.
I can use

Code: Select all

convert +append
and work around it, I suppose, but I would like to know what's going on.

is it the presence of text chunks in the file that's throwing montage off kilter?

Output from identify -verbose (on one of the input files, they're all very similar):
Image: 1574771024.results.png
Format: PNG (Portable Network Graphics)
Mime type: image/png
Class: PseudoClass
Geometry: 553x256+0+0
Units: Undefined
Colorspace: Gray
Type: Grayscale
Base type: Undefined
Endianess: Undefined
Depth: 8-bit
Channel depth:
gray: 8-bit
Channel statistics:
Pixels: 141568
Gray:
min: 0 (0)
max: 255 (1)
mean: 13.5752 (0.0532362)
standard deviation: 49.6399 (0.194666)
kurtosis: 13.8228
skewness: 3.85696
entropy: 0.143257
Colors: 237
Rendering intent: Undefined
Gamma: 0.45455
Chromaticity:
red primary: (0.64,0.33)
green primary: (0.3,0.6)
blue primary: (0.15,0.06)
white point: (0.3127,0.329)
Background color: gray(0)
Border color: gray(223)
Matte color: gray(189)
Transparent color: gray(0)
Interlace: None
Intensity: Undefined
Compose: Over
Page geometry: 553x256+0+0
Dispose: Undefined
Iterations: 0
Compression: Zip
Orientation: Undefined
Properties:
date:create: 2019-11-26T16:17:29+00:00
date:modify: 2019-11-26T15:59:16+00:00
label:

anonymous Fusce convallis leo nec odio tempor, id auctor

urna maximus. Proin ultricies, sem vitae
porttitor tincidunt, ligula velit maximus nisi,
porta rutrum mauris nisl sit amet nisl. Aliquam quis aliquam massa,
non varius arcu. In efficitur mi at odio tempus scelerisque.

maximus. Proin ultricies, sem vitae
nisl sit amet nisl. Aliquam quis aliquam massa,
non varius arcu. In efficitur mi at odio tempus scelerisque.



png:bKGD: chunk was found (see Background color, above)
png:cHRM: chunk was found (see Chromaticity, above)
png:gAMA: gamma=0.45455 (See Gamma, above)
png:IHDR.bit-depth-orig: 8
png:IHDR.bit_depth: 8
png:IHDR.color-type-orig: 0
png:IHDR.color_type: 0 (Grayscale)
png:IHDR.interlace_method: 0 (Not interlaced)
png:IHDR.width,height: 553, 256
png:text: 3 tEXt/zTXt/iTXt chunks were found
png:tIME: 2019-11-26T15:53:49Z
signature: 10a93ce642f44ce38c0c2c30a5944a3098018f6acfea431875bbd4a847d9fd42
Artifacts:
filename: 1574771024.results.png
verbose: true
Tainted: False
Filesize: 7312B
Number pixels: 141568
Pixels per second: 14156800B
User time: 0.000u
Elapsed time: 0:01.009
Version: ImageMagick 6.9.10-14 Q16 i686 2018-11-10 https://imagemagick.org
example input file here: Image

example output file here: Image
Last edited by squiddy on 2019-11-27T10:17:45-07:00, edited 1 time in total.

User avatar
fmw42
Posts: 26269
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Montage inserting whitespace even with +0+0 geometry

Post by fmw42 »

Add +repage after *.png. See if that helps. It removes any remaining virtual canvas in png files

squiddy
Posts: 20
Joined: 2018-09-27T02:53:52-07:00
Authentication code: 1152

Re: Montage inserting whitespace even with +0+0 geometry

Post by squiddy »

Nope, no change

User avatar
fmw42
Posts: 26269
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Montage inserting whitespace even with +0+0 geometry

Post by fmw42 »

Post one of your text files that shows extra space.

squiddy
Posts: 20
Joined: 2018-09-27T02:53:52-07:00
Authentication code: 1152

Re: Montage inserting whitespace even with +0+0 geometry

Post by squiddy »

these are utf-8 text files, "unix format" (i.e. LF line ends)
Lorem ipsum
dolor sit amet, consectetur adipiscing elit.
anonymous Fusce convallis leo nec odio tempor, id auctor
urna maximus. Proin ultricies, sem vitae
porttitor tincidunt, ligula velit maximus nisi,
porta rutrum mauris nisl sit amet nisl. Aliquam quis aliquam massa,
non varius arcu. In efficitur mi at odio tempus scelerisque.
Curabitur dui mi, rhoncus non euismod at, tempus
quis enim. Nulla turpis duis.
maximus. Proin ultricies, sem vitae
nisl sit amet nisl. Aliquam quis aliquam massa,
non varius arcu. In efficitur mi at odio tempus scelerisque.
Curabitur dui mi, rhoncus
It's also at filebin for a week: https://filebin.net/ci53jbc1tu21tw2k

User avatar
fmw42
Posts: 26269
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Montage inserting whitespace even with +0+0 geometry

Post by fmw42 »

This works fine for me on IM 6.9.10.75 Q16 Mac OSX. Note that I have to delete the label meta data that is automatically created or it duplicates the text as text label below the text image. So you would get white text in your font as white on black and black normal text on white below it. I also set the background to black in montage.

Code: Select all

convert -background black -fill white -font candice -pointsize 14 label:@textfile.txt -set label "" textfile.png
montage textfile.png -background black -tile 1x1 -geometry +0+0 textfile_montage.png

squiddy
Posts: 20
Joined: 2018-09-27T02:53:52-07:00
Authentication code: 1152

Re: Montage inserting whitespace even with +0+0 geometry

Post by squiddy »

Perfect, thank you so much.

Post Reply