How to set ImageCollection dpi?
MagickReadSettings settings = new MagickReadSettings();
settings.Density = new PointD(150);
using (MagickImageCollection images = new MagickImageCollection())
{
MagickImage[] image = new MagickImage[CloneMap.Layers.Count];
foreach (SharpMap.Layers.ILayer layer in CloneMap.Layers)
{
SharpMap.Map psdMap = new SharpMap.Map(CloneMap.Size);
foreach (SharpMap.Layers.Layer psdLayer in CloneMap.Layers)
{
if (layer.LayerName == psdLayer.LayerName)
psdMap.Layers.Add(psdLayer);
}
psdMap.ZoomToBox(bx);
Image imageSource = psdMap.GetMap();
ImageConverter converter = new ImageConverter();
image[CloneMap.Layers.IndexOf(layer)] = new MagickImage((byte[])converter.ConvertTo(imageSource, typeof(byte[])), settings);
imageSource.Dispose();
GC.Collect();
image[CloneMap.Layers.IndexOf(layer)].Format = MagickFormat.Psd;
image[CloneMap.Layers.IndexOf(layer)].CompressionMethod = CompressionMethod.RLE;
image[CloneMap.Layers.IndexOf(layer)].Density = new PointD(150);
image[CloneMap.Layers.IndexOf(layer)].Label = layer.LayerName;
images.Add(image[CloneMap.Layers.IndexOf(layer)]);
}
images.Write(filepath + "\\" + filename + "_" + filenumber + fileext);
}
Saved psd only 15 dpi. Why?