Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Increase DPI from 72 to 300 does not work

$
0
0
I decided to add ToGeometry to the Density class. Below are some examples of how you could use this.
Density density = new Density(300, DensityUnit.PixelsPerCentimeter);
MagickGeometry geometry = density.ToGeometry(1.13, 1.5);

/* First option: image has the same aspect ratio */using (MagickImage image = new MagickImage("logo:"))
{
  image.Density = density;

  image.Resize(geometry);

  image.Write("resize.png");
}

/* Second option: crop the image */using (MagickImage image = new MagickImage("logo:"))
{
  image.Density = density;

  image.Crop(geometry, Gravity.Center);

  image.Write("crop.png");
}

/* Third option: extend the image */using (MagickImage image = new MagickImage("logo:"))
{
  image.Density = density;

  image.Resize(geometry);
  image.Extent(geometry, Gravity.Center, MagickColors.Fuchsia);

  image.Write("extent.png");
}

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>