aheckmann / gm

GraphicsMagick for node
http://aheckmann.github.com/gm/
6.95k stars 614 forks source link

the tile command appears to produce an incorrect cmd string in convert context #728

Open dm-ptp opened 6 years ago

dm-ptp commented 6 years ago

Steps to reproduce (box.jpg is a 100x100 image I am tiling):

gm {
  domain:
   Domain {
     domain: null,
     _events: { error: [Function] },
     _eventsCount: 1,
     _maxListeners: undefined,
     members: [] },
  _events: {},
  _eventsCount: 0,
  _maxListeners: undefined,
  _options: {},
  data: {},
  _in: [ '-size', '400x400' ],
  _out: [ '-tile', 'box.jpg'],
  _outputFormat: null,
  _subCommand: 'convert',
  source: '',
  _sourceFormatters: [ [Function] ] }
> gm2.write('boxes.jpg', function(err) {console.log(err);})
undefined
> { [Error: Command failed: gm convert: Request did not return an image.
] code: 1, signal: null }

You can add the following line before the the gm2.write step:

> gm2._out = ['tile:box.jpg']

and this will write the image correctly, without error.

Note that in this example, the image will actually only tile 2x2 instead of the expected 4x4, because of what I can only assume is a bug in core GM where the image ends up doubled in size when applied as a background tile.