renderFile format options
jonshutt opened this issue · 4 comments
Hi,
I'm rendering a bunch of files, but struggling with the format option
map.renderFile(filePath, { format: format }, (err) => { ... }
Eg, format = webp:quality=90
outputs the same file sizes as webp:quality=30
, and jpg
outputs the same as jpg30
as jpg90
.
I'm referencing https://github.com/mapnik/mapnik/wiki/Image-IO to write the formatting options.
Is there something I'm missing?
@jonshutt - your syntax looks fine to me ^ I'm not familiar with all webp
options. This can be mapnik core issue or node-mapnik - I'll find time to debug this issue. Could you post details about your setup - mapnik/node-mapnik versions etc, thanks
@jonshutt - ok, I see what's wrong: renderFile
(async) expects image_format
option while renderFileSync
expects format
. Looks like a bug/typo to me. As a quick workaround you should be able to :
map.renderFile(filePath, { image_format: "webp:quality=30" }, (err) => { ... }
@artemp I just gave that go - but it still didn't seem to make any difference. I did however do a bit more reading, and changed from renderFile to the following, which worked fine and the file quality/size is definitely picking the different formatting options
var im = new mapnik.Image(256, 256);
map.render(im, (err, im) => {
if (err) throw err;
im.save(filePath, "webp:quality=30");
}