生の画像から画像を作成するために ImageMagik 6.7.8 c++ ライブラリを使用しています。問題は、ファイル タイプ "png" の DPI を設定できないことです。一方、 jpeg,tiff では完全に正常に動作します。以下はサンプルコードです
Magick::Image output;
Magick::Blob outputBlob;
output.read(geometry->getWidth(), geometry->getHeight(), "RGBA", Magick::CharPixel, buffer.get()); // Buffer is the raw image
output.resolutionUnits(PixelsPerInchResolution);
const Magick::Geometry gm(150,150);
output.density(gm);
// Write final
output.write(&outputBlob, "PNG");
呼び出し output.write で PNG を JPG または TIFF に置き換えると、正しい DPI が表示されます。